> $last_row ="SELECT from firebase_content LAST_INSERT_ID()"; > $last_row_query = $dbi->query($last_row); > $last_row_result = $row->id;
i think LAST_INSERT_ID will not work for what you wonna do. if you open a connection to MySQL and call LAST_INSERT_ID without a INSERT it will return 0. http://dev.mysql.com/doc/mysql/en/getting-unique-id.html " For LAST_INSERT_ID(), the most recently generated ID is maintained in the server on a per-connection basis. " so it would work if you have only ONE connection for all INSERTs and your SELECT. i think you have to get the highest id first and then select a random row. instead of SELECT MAX() try SELECT `id` FROM `whatever` ORDER BY `id` DESC LIMIT 1; i tried this and it's faster then MAX(). ORDER BY RAND() seems to be the slowest method. chris -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]