Hi peeps,
I've tried to select stuff from a database and display one random result from the query.
$query = mysql_query("SELECT * FROM links ORDER BY RAND() LIMIT 1");
which works fine, but then i decided that I didnn't want to to select links if a row contained a certain word, lets say a swear word for now. so I did:
$query = mysql_query("SELECT * FROM links WHERE words NOT LIKE %'swear'% ORDER BY RAND() LIMIT 1");
which does work, but not how I would like, is there a way I could do select all from links like the first example, and then trim out the NOT LIKE afterwards. So if a word is like swear, it will re-submit the query until there isn't a word like swear. Like putting it in a while loop i guess, i'm just not sure how to do it.
Hope you understand me, i'll have a few more attempts then come back to see if anyone has attempted to understand me.
Thanks
Ant