This is a MySQL question, not a PHP question.  That said, what you want is the 
LIMIT keyword.  

On Sunday 13 January 2008, Danny Brow wrote:
> Just wondering if anyone could tell me how reliable the DESC order
> option is going to be when I am parsing thousands of records where they
> are multiple ChartNo's for the same clientNo. Or is there a better way
> to grab the most recent ChartNo.
>
> $link = mysql_connect('localhost', 'myuser', 'mypassword') or die('Could
> not connect: ' . mysql());
>
> mysql_select_db('mydatabase') or die('Could not select database');
>
> $query = 'SELECT * FROM eChart WHERE clientNo = "2" ORDER BY ChartNo
> DESC';
>
> $result = mysql_query($query) or die('Query failed: ' . mysql_error());
>
> $line = mysql_fetch_array($result, MYSQL_ASSOC);
>
>
> // Just for testing....
> print mysql_num_rows($result);
>
>
>
> Thanks,
> Dan
>
>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.


-- 
Larry Garfield                  AIM: LOLG42
[EMAIL PROTECTED]               ICQ: 6817012

"If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it."  -- Thomas 
Jefferson

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to