ok im sitting in class trying to figure out why this stupid thing wont update anything but id 1 can you guys help me out...
CODE
<?php require_once('../Connections/conn.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE main SET title=%s, content=%s, author=%s WHERE id=%s",
GetSQLValueString($HTTP_POST_VARS['title'], "text"),
GetSQLValueString($HTTP_POST_VARS['content'], "text"),
GetSQLValueString($HTTP_POST_VARS['author'], "text"),
GetSQLValueString($HTTP_POST_VARS['id'], "int"));
mysql_select_db($database_conn, $conn);
$Result1 = mysql_query($updateSQL, $conn) or die(mysql_error());
$updateGoTo = "../index.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
mysql_select_db($database_conn, $conn);
$query_write_main = "SELECT * FROM main";
$write_main = mysql_query($query_write_main, $conn) or die(mysql_error());
$row_write_main = mysql_fetch_assoc($write_main);
$totalRows_write_main = mysql_num_rows($write_main);
?>
<HTML><!-- InstanceBegin template="/Templates/index.dwt.php" codeOutsideHTMLIsLocked="false" -->
<HEAD>
<!-- InstanceBeginEditable name="doctitle" -->
<TITLE>Lindenhurst High School Computer Science Department</TITLE>
<!-- InstanceEndEditable -->
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<link href="../styles.css" rel="stylesheet" type="text/css">
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</HEAD>
<BODY BGCOLOR=#FFFFFF LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0>
<TABLE WIDTH=100% BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
<TR>
<TD COLSPAN=2 background="../images/index_03.gif"><img src="../images/index_01.gif" width="143" height="85">
</TD>
<TD COLSPAN=4 background="../images/index_03.gif"><img src="../images/index_02.gif" width="301" height="85">
</TD>
<TD COLSPAN=4 background="../images/index_03.gif"> </TD>
</TR>
<TR>
<TD background="../images/index_11_bg.gif">
<IMG SRC="../images/index_04.gif" WIDTH=56 HEIGHT=29 ALT=""></TD>
<TD COLSPAN=2 background="../images/index_11_bg.gif">
<IMG SRC="../images/index_05.jpg" WIDTH=100 HEIGHT=29 ALT=""></TD>
<TD background="../images/index_11_bg.gif">
<IMG SRC="../images/index_06.gif" WIDTH=102 HEIGHT=29 ALT=""></TD>
<TD background="../images/index_11_bg.gif">
<IMG SRC="../images/index_07.gif" WIDTH=99 HEIGHT=29 ALT=""></TD>
<TD COLSPAN=2 background="../images/index_11_bg.gif">
<IMG SRC="../images/index_08.gif" WIDTH=104 HEIGHT=29 ALT=""></TD>
<TD background="../images/index_11_bg.gif">
<IMG SRC="../images/index_09.gif" WIDTH=111 HEIGHT=29 ALT=""></TD>
<TD background="../images/index_11_bg.gif">
<IMG SRC="../images/index_10.gif" WIDTH=99 HEIGHT=29 ALT=""></TD>
<TD background="../images/index_11_bg.gif">
<IMG SRC="../images/index_11.gif" WIDTH=89 HEIGHT=29 ALT=""></TD>
</TR>
<TR>
<TD COLSPAN=10><? $content = str_replace("\n", "<br>", $content); ?><br>
<table width="90%" border="1" align="center" cellpadding="1" cellspacing="0" bordercolor="#000000">
<tr>
<td bgcolor="#339933" class="title"><!-- InstanceBeginEditable name="table_title" -->Administrator
Control Panel<!-- InstanceEndEditable --></td>
</tr>
<tr>
<td valign="top"><br>
<table width="95%" border="0" align="center">
<tr>
<td valign="top" class="inner"><!-- InstanceBeginEditable name="main" -->
<form action="<?php echo $editFormAction; ?>" name="form1" method="POST">
<p>
<input name="id" type="hidden" id="id">
<br>
Title:
<input name="title" type="text" id="title">
<br>
<br>
Author:
<input name="author" type="text" id="author">
<br>
<br>
Content: <br>
<textarea name="content" cols="80" rows="15" id="content"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
<input type="hidden" name="MM_update" value="form1">
</form>
<!-- InstanceEndEditable --></td>
</tr>
</table>
<br>
</td>
</tr>
</table>
<br>
</TD>
</TR>
<TR>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=56 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=87 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=13 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=102 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=99 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=87 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=17 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=111 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=99 HEIGHT=1 ALT=""></TD>
<TD>
<IMG SRC="../images/spacer.gif" WIDTH=89 HEIGHT=1 ALT=""></TD>
</TR>
</TABLE>
</BODY>
<!-- InstanceEnd --></HTML>
<?php
mysql_free_result($write_main);
?>
thanks in advance guys...