RE: How to get only 2nd row in result set ???

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will give you the second row of data.

$levels = mysql_query("SELECT levelID "
				."from hf_levels "
				."ORDER BY levelorder " 
				."DESC LIMIT 1, 1") or die('Unable to get
levels<br>'.mysql_error());



-----Original Message-----
From: Mikhail U. Petrov [mailto:mikhail@xxxxxxxx]
Sent: Friday, April 02, 2004 12:16 PM
To: -{ Rene Brehmer }-
Cc: php-db@xxxxxxxxxxxxx
Subject: Re:  How to get only 2nd row in result set ???


Hi!
But what's the problem?
You can use mysql_fetch_array() 2 times.
But may be I understood question not correctly...


Friday, April 2, 2004, 10:06:05 PM, -{ wrote:

RB> I couldn't find anything like this from my archive searches ... so here
goes:

RB> I've got this query:

RB> $levels = mysql_query("SELECT levelID from hf_levels ORDER BY levelorder

RB> DESC LIMIT 2") or die('Unable to get levels<br>'.mysql_error());

RB> but I can't figure out how to write the rest of the code ... I need to
skip 
RB> the first row and get the data from the 2nd row... but because there's
an 
RB> optional up to 255 possible rows in this table, and the order of these
are 
RB> determined by a user customizable field called levelorder ... so I can't

RB> just pick the specific numrows - 1 ... :-/

RB> I know this is a kludge to do it this way ... but it's what I need for
now 
RB> ... later I'll get to do it a more brilliant way...


RB> TIA

RB> Rene
RB> -- 
RB> Rene Brehmer
RB> aka Metalbunny

RB> ~ If you don't like what I have to say ... don't read it ~

RB> http://metalbunny.net/
RB> References, tools, and other useful stuff...
RB> Check out the new Metalbunny forums @ http://forums.metalbunny.net/



-- 
Best regards,
Mikhail U. Petrov
mailto:mikhail@xxxxxxxx

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

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux