note 34568 added to function.mysql-query

From: Date: Thu, 31 Jul 2003 00:05:44 +0000
Subject: note 34568 added to function.mysql-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-53043@lists.php.net to get a copy of this message
If you want to limit your mysql_query, like when publishing the latest news but you only want to publish the 5 newest ones. Then use the LIMIT command but be sure to - !!! call it last in the query !!! - otherwise you will get a error like this: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\file.php on line # example: wrong - mysql_query = ("SELECT * FROM news LIMIT 5 ORDER BY timestamp DESC") rigth - mysql_query = ("SELECT * FROM news ORDER BY timestamp DESC LIMIT 5 ") ---- Manual Page -- http://www.php.net/manual/en/function.mysql-query.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34568 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34568&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34568&report=yes

« previous php.notes (#53043) next »