| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Apr 2004 Location: IL
Posts: 348
![]() | Select Random I'm trying to pull a random quote from my database but keep getting the following error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/content/t/w/i/twiztedfake/html/index.php on line 27 Line 27 is: $row = mysql_fetch_array($result); PHP Code: **Update While looking around some resource sites I found a code snipplet that seems to work for it. Here it is: PHP Code:
Last edited by TwiztedFake; 10-19-2006 at 01:22 PM.
|
| |
| | #2 (permalink) |
| Senior Member Join Date: Aug 2005 Location: East Yorkshire, England
Posts: 2,689
![]() ![]() ![]() ![]() ![]() ![]() ![]() | First of all find out what the error is: PHP Code: |
| |
| | THREAD STARTER #3 (permalink) |
| NamePros Regular Join Date: Apr 2004 Location: IL
Posts: 348
![]() | Here is the error after doing that. Even though I got the other way working I still want to figure this out. SELECT * FROM ct_quotes WHERE ID > '0' ORDER by ID RAND LIMIT 1 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'RAND LIMIT 1' at line 1 |
| |