Page 1 of 1

multiple record query

Posted: Wed Feb 18, 2004 11:32 am
by mccommunity
I am doing a query on a table

Code: Select all

їb]$querymain = "SELECT * FROM auction_event_info WHERE client_event_id='$eventid'";
$r = pg_exec($c,$querymain);ї/b]

Say there are two records with the same $eventid if I use:

Code: Select all

їb]$info = pg_fetch_array($r, 0);ї/b]
it will pull the first occurance row with this event id. How do I do the same but skip the first row and pull the second row? Can I do this:

Code: Select all

їb]$info2 = pg_fetch_array($r, 1);ї/b]
Will the above pull an array of the second occurance? If not how do I do this?

Posted: Wed Feb 18, 2004 3:08 pm
by steve@oeic.net
$info2 = pg_fetch_array($r, 1); should work fine. If not, you can compare the event_id fields from $info and $info2, and if they are the same, just output $info2.