title: Print a random row from a mysql query
body: <p>I was looking for a way of creating a collaborative translation widget. So I have a mysql database and table (called translations), and a little script to allow users to translate one page at a time.</p>
  
  <p>But I'm not quite convinced with my script. I don't think it's efficient enough. First, the mysql gets all the rows with the empty 'en' column, and then a single one of them is showed by screen through a while. Is there any other way of doing this? This is the code:</p>
  
  <pre><code>//Retrieve all the data from the "translations" table
  $result = mysql_query("SELECT * FROM translations WHERE en IS NULL OR en=''") or die(mysql_error());
  
  $Randnum=rand(0,mysql_num_rows($result)-1); //Gets a random number between 0 and the maximum number of rows
  $i=0;   //Start to 0
  while($Col = mysql_fetch_array($result))  //While there are rows to evaluate
      {
      if ($i==$Randnum)
          {
          echo "\"".$Col['es']."\"&lt;br&gt;&lt;br&gt;Translate it to English: &lt;br&gt;";
          }
      $i++;
      }
  </code></pre>
  
  <p><strong>I was looking for something like "echo $Col[$Randnum]['es']" or  "echo $Col.$Randnum['es']" instead of using the whole while loop to print a single random row. How can I implement this?</strong> If it's just a matter of optimization. If you could come with an script or idea to assign to $Col just ONE row with a random number and the empty 'en' col, that'd be even better! (I think it's not possible this last bit). The 'en' row is text so I don't know how to implement <a href="https://stackoverflow.com/questions/3502096/mysqlhighload-random-row-from-big-query-result">other methods</a> I've seen around as they use number with ORDER BY.</p>