Author Topic: Dummy dumb PHP/MySQL Q  (Read 691 times)

0 Members and 1 Guest are viewing this topic.

GilloD

  • TAKE THE LIFE OF FRED ASTAIRE. MAKE HIM PAY. TRANSFER HIS FAME TO YOU.
  • Senior Member
Dummy dumb PHP/MySQL Q
« on: June 27, 2009, 08:11:35 PM »
Okay, so I'm using mysql_fetch_array to fetch a bunch of rows from a table.

Code: [Select]
$query_lots="SELECT * FROM lots_new WHERE lot_sku_id='$curr_key'";
$lots_result=mysql_query($query_lots) or die(mysql_error());
while($lots_row=mysql_fetch_array($lots_result)){
}


How can I tell $lots_result to SKIP the first row? I want to start with the SECOND result and move to the end. I can get a count of the rows in teh $result via mysql_num_rows, but I can't tell it "JUST GIVE ME ROW 2 and ONWARDS"
wha

demi

  • cooler than willco
  • Administrator
Re: Dummy dumb PHP/MySQL Q
« Reply #1 on: June 27, 2009, 08:15:50 PM »
fat

GilloD

  • TAKE THE LIFE OF FRED ASTAIRE. MAKE HIM PAY. TRANSFER HIS FAME TO YOU.
  • Senior Member
Re: Dummy dumb PHP/MySQL Q
« Reply #2 on: June 27, 2009, 08:17:43 PM »
Hmm.

Okay, let me expand my explanation a bit.

Basically, the first result row is displayed in one way.

Every row AFTER that first row is displayed differently. But I can't just use an "if num_row>1" because it'll pop out EVERY row for EVERY success. So I need to go ahead and display row one, then do a conditional which BEGINS at row 2. I sitll need row 1.
wha

GilloD

  • TAKE THE LIFE OF FRED ASTAIRE. MAKE HIM PAY. TRANSFER HIS FAME TO YOU.
  • Senior Member
Re: Dummy dumb PHP/MySQL Q
« Reply #3 on: June 27, 2009, 08:18:17 PM »
I could setup two querys- One limited to 1 and one going from 2 and beyind, but that seems dumb
wha

GilloD

  • TAKE THE LIFE OF FRED ASTAIRE. MAKE HIM PAY. TRANSFER HIS FAME TO YOU.
  • Senior Member
Re: Dummy dumb PHP/MySQL Q
« Reply #4 on: June 27, 2009, 10:22:08 PM »
Code: [Select]
$lots_result = ...
$first_row_values = mysql_fetch_array($lots_result))

while ($row = mysql_fetch_array($lots_result)) {
... 2onwards}

So it rips off the first result, I always display that one and if there are others remaining we deal with them
wha