Forum Moderators: coopster

Message Too Old, No Replies

has problem for update database

has problem for update database

         

xbl01234

5:17 am on Jan 7, 2008 (gmt 0)

10+ Year Member



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'");

Habtom

5:28 am on Jan 7, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$result=mysql_query('UPDATE Thread SET Subject='. $subject .', Content='. $content .' where Id='.$threadId.'');

xbl01234

7:18 am on Jan 7, 2008 (gmt 0)

10+ Year Member



Thanks a lot, it works now.