Hi all,
I am in the process of changing my little news script, and I have successfully added a delete article function. I have also added an amost identical update function, which looks syntaxically correct, but when I click the "update" link, it updates that record, but not like it should. It should update the text with the newly inserted text, but instead it totally blanks the entry out!
This is my function:
function updnews($id)
{
require "config.php";
$link = mysql_connect("$db_host","$db_user","$db_pass");
mysql_select_db("$db_name",$link);
$query="UPDATE $table SET newstitle='$newstitle', news='$news' WHERE id = '$id'";
mysql_query($query) or print "<b>>>> MySQL-Error: ".mysql_errno()." -> ".mysql_error()."</b><br>\n";;
}
if( isset($update))
{
updnews($update);
echo "<strong>The article was updated!<br>";
echo "<strong>Click <a href=\"{$_SERVER['PHP_SELF']}\">HERE</a> to return to the admin section";
return $query;
}
...and this is the update news link:
<a href=\"{$_SERVER['PHP_SELF']}?update=$id\">Update</strong></a>";
The syntax is almost the same as the delete function I am using, and that works fine - why is this function updating the record with a blank field? Any ideas?