0

Hello all,
I am currently trying to insert a 0 value into a single field. The value is originally set to 1 and I would like to set it to its default value of 0. How would I go about doing that?
The code I have works for other things, but I simply want to change the field of online1 to 0 in the database table. This is what I have:

            mysql_query("UPDATE `users` SET `online1` = 0  WHERE `id` = '".$_SESSION['uid']."' ");

Thanks for the help!

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by diafol
0

Looks OK.

mysql_query("UPDATE `users` SET `online1` = 0  WHERE `id` = {$_SESSION['uid']}");

Assuming both online1 and id are integer fields. echo out the query to see if it matches your expectation.

echo "UPDATE `users` SET `online1` = 0  WHERE `id` = {$_SESSION['uid']}";
0

I did what you said and there was an error. After fiddling around for a bit, I finally found the error. Thanks for your help! I appreciate it!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.