I’m trying to grab multiple rows via these lines from the MySQL database:
$msg_sql = "SELECT * FROM ".TABLE_PREFIX."quotes ORDER BY rand(curdate()) LIMIT 3";
$msg_res = mysqli_fetch_assoc(mysqli_query($link, $msg_sql));
print_r($msg_res);
However, I only get 1 row back. Which is:
Array ( [id] => 1 [message] => test_message [Link] => link here )
I wish to get multiple rows (so multiple ID’s)
Please tell me what I’m doing wrong. I’m still new to MySQL.
You must loop once for each row you fetch.