floridaflatlander Posted December 20, 2011 Share Posted December 20, 2011 says update succesfull but it doesnt even updates Have you ckd your database? Quote Link to comment https://forums.phpfreaks.com/topic/253558-update/page/2/#findComment-1299843 Share on other sites More sharing options...
Pikachu2000 Posted December 20, 2011 Share Posted December 20, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/253558-update/page/2/#findComment-1299844 Share on other sites More sharing options...
melloorr Posted December 20, 2011 Share Posted December 20, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/253558-update/page/2/#findComment-1299845 Share on other sites More sharing options...
AyKay47 Posted December 20, 2011 Share Posted December 20, 2011 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()); Quote Link to comment https://forums.phpfreaks.com/topic/253558-update/page/2/#findComment-1299846 Share on other sites More sharing options...
ecabrera Posted December 20, 2011 Author Share Posted December 20, 2011 Pikachu2000 was right i didnt echo out the $newid i just left it like it had no value so i echo it out and now it says thanks alot guys for all your help Quote Link to comment https://forums.phpfreaks.com/topic/253558-update/page/2/#findComment-1299849 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.