FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Checking MySQL column and displaying some entries ..





ftv_flung
I'm trying to do something that I need help with in PHP...

I want it to display one random row from my database, but only verified ones (from the "verified" column)

So far I have:

Code:
SELECT * FROM database ORDER BY RAND() limit 1


But I want it to check the Verified column... so if it says 0 it wont display that row... and if it is 1, it will display (if it's picked from the random thing).


I hope this makes sense - help! Thanks Wink Smile
Star Wars Fanatic
Here, this isn't tested, but it should work:

Code:
SELECT * FROM database WHERE verified = '1' ORDER BY RAND() LIMIT 1


Let me know if it doesn't, and I'll take a better look at it.
ftv_flung
Yeah, it works! Thanks Smile

I forgot about WHERE... haha

cheers again Star Wars Fanatic
Related topics
Make search engine With PHP and mySQL, for your site
MySQL statement error (got me going)
Mysql error!
Guestbooks?
Suppressing mysql error
MySql error: Column count doesn't match value count at row 1
SQL Insert
Getting host to connect to my local mysql?
[URGENT!!] MySQL not Displaying Queries Correctly
mySQL help needed, any other good database thing?
Remote php file access and reading
500Frih$ for random feed entries
duvida no WP-DBManager
Moving images from database to filesystem
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.