Woodburn2006 Posted May 10, 2008 Share Posted May 10, 2008 how would i grab a random result from a DB? i have a DB full of stuff for my portfolio and i want to grab a random row from the DB to display on a page so that everytime the page is loaded it grabs a random result to display. is there a way of doing this? Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted May 10, 2008 Share Posted May 10, 2008 SELECT image FROM some_table ORDER BY RAND() LIMIT 1; Quote Link to comment Share on other sites More sharing options...
Fadion Posted May 10, 2008 Share Posted May 10, 2008 BlueSkyIS gave u the answer, but this is a question that google can answer it easily. I searched for "php mysql random row" and the very first page gives the right code. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.