displaying row number when going thru records

  • buzzby365
  • Proficient
  • Proficient
  • buzzby365
  • Posts: 288

Post 3+ Months Ago

i got this code:
PHP Code: [ Select ]
if($_POST['button'] == 'next'){
 
$OFFSET++;
 
}else{
 
$OFFSET--;
 
}
 
$result = mysql_query("select * from gstrialforma order by id LIMIT $OFFSET,1",$connection);
  1. if($_POST['button'] == 'next'){
  2.  
  3. $OFFSET++;
  4.  
  5. }else{
  6.  
  7. $OFFSET--;
  8.  
  9. }
  10.  
  11. $result = mysql_query("select * from gstrialforma order by id LIMIT $OFFSET,1",$connection);

rather than use where id = whatever i have used limit. that way no metter if i add or delet a row i wont get any descrepencies when lookin for a row. what i need to do is store the offset so i know what row i am on. i think the best way is to have a hidden field but i am not sure how to go about it.
  • Cafu
  • Student
  • Student
  • Cafu
  • Posts: 97

Post 3+ Months Ago

why not put the current row in the session?

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 31 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.