used is a column name, if you need to surround it use the back ticks (beow the esc key, same button as the tilde (~). That is why it shouldn't be req'd for the update, though the value may need to be quoted depending on the col data type


From: "Ron Piggott" <[EMAIL PROTECTED]>
Reply-To: "Ron Piggott" <[EMAIL PROTECTED]>
To: "Webmaster" <[EMAIL PROTECTED]>
CC: "PHP DB" <>
Subject: [PHP-DB] Re: UPDATE command
Date: Fri, 17 Jun 2005 23:47:31 -0400

This is kind of interesting ...

$query="SELECT * FROM quiettimequotation WHERE used = 0 ORDER BY RAND()


$query="SELECT * FROM bibleverses WHERE 'used' = 0 ORDER BY RAND() LIMIT 1";

doesn't!  Having the ' around used makes that select command fail --- but
the UPDATE command requires it!

Thanks for those of you who responded to my question below. I am creating a
mailing list for my web site that I am wanting each entry which is randomly
selected from the database to only be used once and not be available again
until the entire list has been used.  I needed the UPDATE command to change
the used column all back to 0 again once the last entry had been selected
from the database.  I think I like programming mySQL stuff :)  Ron


>Does the UPDATE command only change one row or each occurance if the the
>criteria repeat itself through the table?

PHP Database Mailing List (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to