Issues updating MySQL value

Codes here !

Moderators: macek, egami, gesf

Post Reply
johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Issues updating MySQL value

Post by johnj » Mon Jul 09, 2012 7:29 pm

Please brush up you understanding on data manipulation language.

rupali
New php-forum User
New php-forum User
Posts: 140
Joined: Thu Oct 13, 2011 10:32 pm
Location: Chandigarh, INDIA

Re: Issues updating MySQL value

Post by rupali » Mon Jul 09, 2012 11:34 pm

hi,

there is an issue in the query as the description field is in text form so in query use '' to declare text variable,
code should be like this:

mysql_query("UPDATE users SET description='$text' WHERE user_id=$userid");

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Issues updating MySQL value

Post by johnj » Tue Jul 10, 2012 12:00 am

Another thing that you can try is:

change mysql_query("UPDATE users SET description=$text WHERE user_id=$userid");

to

$sql = "UPDATE users SET description=$text WHERE user_id=$userid";
echo $sql;
mysql_query($sql);

echo $sql will tell you whether $text and $userid has a value in it.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests