[snip]
PHP code:
$result = mysql_query("SELECT * FROM products WHERE sale_price IS NOT NULL
ORDER BY RAND() LIMIT 3") or die(mysql_error());

The error message is as follows:

You have an error in your SQL syntax near 'RAND() LIMIT 3' at line 1
[/snip]

Using;

$query = "select * from tblBAR WHERE DiskSize IS NOT NULL ORDER BY RAND()
LIMIT 3 ";
if(!($db = mysql_query($query, $dbconnect))){
        print("MySQL reports: " . mysql_error() . "\n");
        exit();
        }
while($row = mysql_fetch_object($db)){
        print($row->ID . "&nbsp" . $row->ClientName . "<br>");
}

This worked fine for me. Maybe there is not a space between NULL and ORDER?

Jay



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to