note 96465 added to function.rand
| From: | bohacpetrATbohynDOTcz at osu1 dot php dot net | Date: | Mon, 01 Mar 2010 01:55:19 +0000 |
| Subject: | note 96465 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-166453@lists.php.net to get a copy of this message | ||
To mike at marylandwebsites dot net:
It's not nice pice of code you have sent. You shoud better try something like this:
<?php
$SQL = <<< EOT
SELECT *
FROM
(SELECT *
FROM HIGHLIGHTS
ORDER BY highlight_id DESC
LIMIT 5) AS t1
ORDER BY RAND()
LIMIT 1
EOT;
$result = mysql_query( $SQL );
while( $row = mysql_fetch_assoc( $result ) ) {
// ...
}
?>
----
Server IP: 147.32.160.17
Probable Submitter: 90.178.112.201
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- https://master.php.net/note/edit/96465
Del: integrated -- https://master.php.net/note/delete/96465/integrated
Del: useless -- https://master.php.net/note/delete/96465/useless
Del: bad code -- https://master.php.net/note/delete/96465/bad+code
Del: spam -- https://master.php.net/note/delete/96465/spam
Del: non-english -- https://master.php.net/note/delete/96465/non-english
Del: in docs -- https://master.php.net/note/delete/96465/in+docs
Del: other reasons-- https://master.php.net/note/delete/96465
Reject -- https://master.php.net/note/reject/96465
Search -- https://master.php.net/manage/user-notes.php