What does your PHP code look like ? It might be a syntax problem inside PHP
....

-----Message d'origine-----
De : Jamie Tibbetts [mailto:[EMAIL PROTECTED]]
Envoye : jeudi 11 juillet 2002 18:22
A : [EMAIL PROTECTED]
Objet : ORDER BY RAND() not working

I'm running PHP 4.1.2 and MySQL 3.23.39. I have a simple query that works if
I telnet into MySQL and run the query manually. If I try and use it in a PHP
page, I get the "Supplied argument is not a valid MySQL result resource"
error. However, if I take out the ORDER BY RAND() part from the query, it
works in PHP.

Doesn't work:
SELECT * FROM products WHERE sale_price IS NOT NULL ORDER BY RAND() LIMIT 3

Works:
SELECT * FROM products WHERE sale_price IS NOT NULL LIMIT 3

Does anyone have any idea why this is happening?

Thanks,
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

Reply via email to