PHP Help - 11/11/2001 7:27 AM
I made a script to make the news on my site and now I am working on an editing script. But I can't get it update it right:
Robs Post thingy
$db = @mysql_connect("localhost","Rob","fdsafd");
mysql_select_db(stonecrick);
if ($post){
// WE dont need timestamp since its already in db
// UPDATE statement, it checks and sees if new thing submitted is diff, if so it updates it in same row
$sql="UPDATE data SET title=".addslashes($title)." author=$author, email=$email, body=$body, WHERE ID=$newsid ";
if (@mysql_query($sql)) {
echo("success");
}else{
echo ("error" .$sql);
}
}else{
// Selects info from dat from row where id = userid
// Thus they have to go to the page like so: edit.php?newsid=1
$usr = @mysql_query("SELECT * FROM data WHERE ID=$newsid");
// Then put all info into a form, this form puts the info already in text boxes and stuff
// That way when person goes here theey dont have to retype they just edit
while($row=mysql_fetch_array($usr)){ ?>
} }
?>
I get the eror:
errorUPDATE data SET title=Title author=12345, email=09, body=12345, WHERE ID=1
Thanks in advance!
$db = @mysql_connect("localhost","Rob","fdsafd");
mysql_select_db(stonecrick);
if ($post){
// WE dont need timestamp since its already in db
// UPDATE statement, it checks and sees if new thing submitted is diff, if so it updates it in same row
$sql="UPDATE data SET title=".addslashes($title)." author=$author, email=$email, body=$body, WHERE ID=$newsid ";
if (@mysql_query($sql)) {
echo("success");
}else{
echo ("error" .$sql);
}
}else{
// Selects info from dat from row where id = userid
// Thus they have to go to the page like so: edit.php?newsid=1
$usr = @mysql_query("SELECT * FROM data WHERE ID=$newsid");
// Then put all info into a form, this form puts the info already in text boxes and stuff
// That way when person goes here theey dont have to retype they just edit
while($row=mysql_fetch_array($usr)){ ?>
} }
?>
I get the eror:
errorUPDATE data SET title=Title author=12345, email=09, body=12345, WHERE ID=1
Thanks in advance!