I have this code and am looking to make a sort of "quotes area" on my website. I want it to select 3 random quotes from my database everytime. I know about the function rand(min,max)
, but how do I use it to select that exact row from the query?
require 'DB.php';
$link = mysql_connect('localhost', 'root', '430123');
$db = mysql_select_db('bakery', $link);
$result = mysql_query('SELECT * FROM quotes');
I could use a for loop and use mysql_fetch_row()
for how much the number from rand()
was, but that could be a bit inefficient maybe?