The Daily Static
  The Daily Static
UF Archives
Register
UF Membership
Ad Free Site
Postcards
Community

Geekfinder
UFie Gear
Advertise on UF

Forum Rules
& FAQ


Username

Password


Create a New Account

 
 

Back to UserFriendly Strip Comments Index

MYSQL Update Random Row? Possible? by MikeCDN2005-05-04 12:53:17
  You can't just... by sylvan 2005-05-04 13:31:38
... do WHERE id=rand(), rand() returns a floating point value between 0 and 1, and I'm willing to bet that your id column contains something other than that... ;-)

If you are ABSOLUTELY sure your id's are contigous, you could do WHERE id=rand()*max(id)+1, but odds are your id's are or will become non-contigous, and sooner or later you'll hit one of those holes and MySQL will burp errors at you.

Nope, you'll have to do some kind of pre-query to find a valid id to update.

[ Reply ]
    Erg.. by sylvan2005-05-04 13:40:47

 

[Todays Cartoon Discussion] [News Index]

Come get yer ARS (Account Registration System) Source Code here!
All images, characters, content and text are copyrighted and trademarks of J.D. Frazer except where other ownership applies. Don't do bad things, we have lawyers.
UserFriendly.Org and its operators are not liable for comments or content posted by its visitors, and will cheerfully assist the lawful authorities in hunting down script-kiddies, spammers and other net scum. And if you're really bad, we'll call your mom. (We're not kidding, we've done it before.)