How do you get the row returned by this SQL query using PHP:
SET @r := (SELECT ROUND(RAND() * (SELECT COUNT(*) FROM mytable)));
SET @sql := CONCAT('SELECT * FROM mytable LIMIT ', @r, ', 1');
PREPARE stmt1 FROM @sql;
EXECUTE stmt1;
Setting $query
equal to the above and then doing the usual mysql_query($query)
is not returning any results.