hey guys, in a table as such i could not choose two random figures. the table being: Code: INSERT INTO `c` (`id`, `photo`, `photo1oy`, `categories`, `name`) VALUES this way, the id will automatically increase, i want to be able to choose 2 random figures (id) as $x and $y, but everytime a figure is chosen $x will always be a higher figure than $y. does anybody know how this could happen?
If I understood you right: SELECT * FROM (SELECT * FROM c ORDER BY RAND() LIMIT 2) A ORDER BY id DESC; Code (markup): Regards
If I'm getting you correctly, you need to select a random picture, and also select another random picture whose id is greater than the id of previously selected id. Is that right? You can run 2 queries for that... $q=mysql_query("select id, photo from `c` order by rand() limit 1"); $row= mysql_fetch_assoc($q); $id= $row[id]; "select id, photo from `c` where id>'$id' order by rand() limit 1" Thanks