I don't have your exact setup installed so cannot verify this, but how about
rewriting your statement a little? I just tried this in mysql and it works
fine, so it may from php. Let me know :-)
Change the query to:
SELECT *, Rand() as MyOrder
FROM products
WHERE sale_price IS NOT NULL
ORDER BY MyOrder;
hth,
Arthur
----- Original Message -----
From: "Jamie Tibbetts" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 11, 2002 1:14 PM
Subject: Re: ORDER BY RAND() not working
> > $id = mysql_query("SELECT * FROM products WHERE sale_price IS NOT NULL
ORDER
> > BY RAND() LIMIT 3",$link) or die(mysql_error());
>
> 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
>
> Jamie
>
> Jamie Tibbetts ..... [EMAIL PROTECTED]
> Epigroove ..... http://www.epigroove.com/
>
>
> ---------------------------------------------------------------------
> 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
>
---------------------------------------------------------------------
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