i used this script on one server and it worked. when i transferred it over.. it no longer works.
<?
$usr = "...";
$pwd = "...";
$db = "...";
$host = "localhost";
$cid = mysql_connect($host,$usr,$pwd);
mysql_select_db($db);
if (!$cid) { print "ERROR: " . mysql_error() . "\n"; }
?>
<html>
<head>
<title>Add News</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?
this is processed when the form is submitted
back on to this page (POST METHOD)
if ($_SERVER['REQUEST_METHOD'] == "POST")
{
escape data and set variables
$date = addslashes($POST["date"]);
$update = addslashes($POST["update"]);
# setup SQL statement
$sql = " INSERT INTO news ";
$sql .= " (date, update) VALUES ";
$sql .= " ('$date', '$update') ";
#execute SQL statement
$result = mysql_query($sql, $cid);
# check for error
if (mysql_error()) { print "Database ERROR: " . mysql_error(); }
print "<p>new news added</p>\n";
}
?>
<form name="fa" action="addnews.php" method="POST">
<b> </b>
<table width="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="14" width="50"><b>date:</b></td>
<td height="14">
<input type="text" name="date" size=40>
</td>
</tr>
<tr>
<td height="14" width="50" valign="top"><b>news:</b></td>
<td height="14">
<textarea name="update" cols="40" rows="12"></textarea>
</td>
</tr>
<tr>
<td height="14" width="50"> </td>
<td height="14">
<input type="submit" value="Add Feature" name="submit">
</td>
</tr>
</table>
<p> </p>
</form>
</body>
</html>
this is the error message
Database ERROR: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'update) VALUES ('12.11', 'test')' at line 1
why would this work on one server and not another? different php?
please help thank you