I have a column with 4 rows. I use a query to return a random row but 95% of the time, I get the first row in the table. Very rarely do I get any other row than the first. Is there someething wrong with the way I am using this function in PHP?
//Array with the data to insert
$sql_array = array(
'rightcolumn' => 'rightcolumn',
);
// Create the SQL statement
$sql = 'SELECT * FROM ' . rightcolumn . '
ORDER BY RAND() = ' . 1;
// Run the query
$result = $db->sql_query($sql);
// $row should hold the data you selected
$row = $db->sql_fetchrow($result);
// Be sure to free the result after a SELECT query
$db->sql_freeresult($result);
// Show we got the result we were looking for
echo $row['rightcolumn'];