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
I have the posting script and edit. But the way they are set up, right when you open the script it recognizes that. I wanted to change it so I could go like cp.php?func=editnews or cp.php?func=postnews.
But I am not sure. Cause the way I wrote them weren't for that. And I couldn't figre it out..
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