Re: Pulling one record from a db(newbie)
| From: | David Robley | Date: | Mon, 27 May 2002 03:31:52 +0000 |
| Subject: | Re: Pulling one record from a db(newbie) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-99326@lists.php.net to get a copy of this message | ||
In article <034501c2052b$0b8abed0$0100a8c0@JohnH>, webmaster@tececo.com
says...
> Hi,
>
> I know how to use limit to pull 2 or more records out of a database.
>
> What I wish to do is only pull one record from a database.
>
> I am using the following query:
> $query = "select * from news limit LIMIT $id, ++id";
>
> I get all sorts of parse errors and stuff.
>
> Please Help.
>
> Also is there a function to return only one record?
>
> JJ Harrison
> www.tececo.com
> webmaster@tececo.com
>
$query = "select * from news LIMIT 1";
and if you want a particular order you need to add ORDER BY (ASC or DESC)
depending on your exact need.
--
David Robley
Temporary Kiwi!
Quod subigo farinam