Search Results

Search found 1 results on 1 pages for 'user1476925'.

Page 1/1 | 1 

  • Select unseen random row from MySQL table

    - by user1476925
    We have a list of questions in a MySQL database and want it to show a random approved question to the user. When you click the Random button, we want another random question to be shown, but not any of the ones the user has already seen. Right now the script looks like this: <?php mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("aldrig") or die(mysql_error()); $result = mysql_query("SELECT * FROM spg WHERE approved='1' ORDER BY RAND() LIMIT 1;") or die(mysql_error()); while($row = mysql_fetch_array( $result )) { echo "<div class='contentTitle'><h1>"; echo $row['text']; echo "</h1></div>"; } ?>

    Read the article

1