Three MySQL treats

  1. Get the auto int that was just inserted:

    select last_insert_id();
    
  2. Get a random list:

    select * from some_table order by rand();
    
  3. Get one row from a table:

    select * from some_table limit 1;
    

Now put them together. Or, maybe just the last two.

Posted 09 Aug 2007, tagged with mysql