Jump to content


Photo

showing record (page by page)


  • Please log in to reply
2 replies to this topic

#1 vickytam

vickytam
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 12 April 2006 - 05:36 AM

Dear all,

I wrote some code as below:

<?php
…… (Connected to database & get 1000 records from database (using array function)
$date = $row['date'];
$product = $row['product']; ?>

<table border="1">
<tr>
<td><?php echo $date; ?></td>
<td><?php echo $product; ?></td>
</tr>
</table>



There are 1000 records were loaded via array function. How can I make a page break function?
Each page will show 100 records only. Can anyone help?
Thank you.

Regards,
Vicky

#2 bonaparte

bonaparte
  • Members
  • PipPipPip
  • Advanced Member
  • 44 posts
  • Location#172, I Floor, 'Hamsashree', Defence Colony, Sahakaranagar, Bangalore, India

Posted 12 April 2006 - 06:42 AM

[!--quoteo(post=363899:date=Apr 12 2006, 12:36 AM:name=Vicky)--][div class=\'quotetop\']QUOTE(Vicky @ Apr 12 2006, 12:36 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Dear all,

I wrote some code as below:

<?php
…… (Connected to database & get 1000 records from database (using array function)
$date = $row['date'];
$product = $row['product']; ?>

<table border="1">
<tr>
<td><?php echo $date; ?></td>
<td><?php echo $product; ?></td>
</tr>
</table>
There are 1000 records were loaded via array function. How can I make a page break function?
Each page will show 100 records only. Can anyone help?
Thank you.

Regards,
Vicky
[/quote]

Get the no. of rows affected with mysql_affected_rows(). Use limit in your queries to limit the no of rows fetching.

For example,

mysql_query("seelct * from <tablename> limit 25,10") fetches the rows from 25 to 35.

Then pass the row number with a next button and execute the script.




#3 vickytam

vickytam
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 12 April 2006 - 06:50 AM

Thank you.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users