xbl1 Posted January 7, 2008 Share Posted January 7, 2008 Hi;I am trying to update my database, but the problem for me is the old value replace with the value of the " " (empty). my code as following;$subject=$_POST['subject'];$content=$_POST['content'];echo $subject;echo $content;$result=mysql_query("UPDATE Thread SET Subject='$subject', Content='$content' where Id='$threadId'");there are not problem for the "echo $subject" and "echo $content;"but if rewrite as following, it does update the values from database.$result=mysql_query("UPDATE Thread SET Subject='subject', Content='content' where Id='$threadId'"); Link to comment Share on other sites More sharing options...
Synook Posted January 7, 2008 Share Posted January 7, 2008 To check for errors have you tried echo mysql_error(); Link to comment Share on other sites More sharing options...
jhecht Posted January 7, 2008 Share Posted January 7, 2008 What Synook said, just do it after the query, or usually you stop execution(mysql_query('blah') OR die(mysql_error());, for example).If you don't have any errors, you may want to echo out the string itself to see if there are any issues in the words, or if you need to use mysql_real_escape_string. Link to comment Share on other sites More sharing options...
xbl1 Posted January 8, 2008 Author Share Posted January 8, 2008 Thanks for borth;it does work now. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.