Jump to content

how to get the current row number


nahla123

Recommended Posts

If I understand correctly, you will need to select an ID of the row you want to display.

 

So, for example, if you want to display row number 3 (out of 10). You will need to do a query like

 

$sql = mysql_query("SELECT * FROM tblName WHRE id = '3'") or die (mysql_error());

 

This peace of code would display a row where ID = 3 (so, if prepared like I assume, it would be a row number 3).

 

But, again, it's hard to understand what are you asking for.

mysql pagination is used with LIMIT, eg:

 

SELECT * FROM `table` LIMIT 0,15;

SELECT * FROM `table` LIMIT 15,15;

SELECT * FROM `table` LIMIT 30,15;

 

where the first number is the row OFFSET, eg how many rows to SKIP.

the second number is the MAX ROWS, how many rows it can count to until it stops.

 

hope this helps,

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.