[SOLVED] Random Quotes
Posted: Fri Nov 28, 2003 12:38 pm
I followed a tutorial on this and came out with non-working code.
My code:
Can anyone figure out what I'm doing wrong?! Thanks!
My code:
Code: Select all
<?php
echo "<b><u>Q u o t e s</u></b><BR><BR>";
$query = "SELECT firstname, lastname, pretext, text FROM quotes";
$result = mysql_query($query) or die (mysql_error());
while($row = mysql_fetch_array($result)){
$row_array[] = "{$row['firstname']} {$row['lastname']}, {$row['pretext']}<BR>"{$row['text']}"";
}
$random_row = $row_array[rand(0, count($row_array) - 1)];
echo $random_row;
?>