Page 1 of 1
Selecting certain rows in a mysql table.
Posted: Fri Mar 10, 2006 4:03 pm
by mattyboi
I would like to know if there is a way to select the first row in a table. Once I've selected and pulled out the info I needed from that first record, I then would like to select the next row in the table.
Thanks
Posted: Fri Mar 10, 2006 4:06 pm
by feyd
Code: Select all
$query = mysql_query('SELECT * FROM `table`);
while($row = mysql_fetch_assoc($query))
{
// do stuff for each row.
}
Posted: Fri Mar 10, 2006 4:08 pm
by mattyboi
That works for all the rows in the table. I only would like to capture the first row and then the row following the first. I remember in SQL there was a next_row function and a previous_row function. I was wondering if there was something similar in mySQL.
Posted: Fri Mar 10, 2006 4:17 pm
by feyd