Re: WHERE problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How about this instead, Mike?

<?php
// some code

$fortune = mysql_query("SELECT text FROM fortunes ORDER BY RAND() LIMIT 1");
$fortune = mysql_fetch_row($fortune);
$fortune = sprintf(
'<span class="quotecyc">&quot;%s&quot;<br />-Omniversalism.com</span>',
$fortune[0]
);

// some more code
?>

MySQL is implemented in random code, so it can probably perform this
operation faster, and this code is much cleaner.  You may want to move
away from mysql since it's essentially deprecated.  I have switched to
mysqli and prefer it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux