Jump to content

Update


ecabrera

Recommended Posts

Here's a problem: <input type='hidden' name='saveedit' value='$newid'/> You didn't echo the value of the variable in the value= attribute, therefore the value is the string literal '$newid'. That is probably the major part of this issue, since none of your records will have '$newid' as the value of the primary key.

Link to comment
https://forums.phpfreaks.com/topic/253558-update/page/2/#findComment-1299844
Share on other sites

Pikachu2000 is right this has nothing to do with update problem i tred checking my code alot of times but i can figure it out when i update it says update succesfull but it doesnt even updates

 

Well you said it says it updates, but it doesn't change anything. So maybe your variables are confused. At the top of your code, to have assigned the old data the the same variables you assigned the new data too. Maybe its just that instead of sending the new data, it is sending the old data instead. Its worth changing the variable names just to be sure

Link to comment
https://forums.phpfreaks.com/topic/253558-update/page/2/#findComment-1299845
Share on other sites

lets get back on topic, pickachu stated why the $msg error is occurring, this leads the error to be in the update query, can you post your new query code please.

 

it says update successful because you have not checked the validity of your query before outputting that sentence.. what you should be doing is only outputting that if the query returns true..

 

$query = mysql_query("UPDATE news SET title='$newstitle', `by`='$newsby', body='$newsbody' WHERE id='$newid'");

if($query)
      echo "UPDATE SUCCESFULLY!";
else
       die(mysql_error());

Link to comment
https://forums.phpfreaks.com/topic/253558-update/page/2/#findComment-1299846
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.