How to pull the first occurrence out of a database

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
tonykasdorf
Forum Newbie
Posts: 6
Joined: Wed Mar 31, 2010 7:13 am

How to pull the first occurrence out of a database

Post by tonykasdorf »

I'm creating a query into my database. The query returns 5 rows but I would like to output the data from the first row only. What mysql function could I use that will allow my to output data from the first row?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: How to pull the first occurrence out of a database

Post by AbraCadaver »

[text]LIMIT 1[/text]
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply