how i can paginating unlimited data from My sql , if i want to use the limit , i must know the number of rows, but i don't know the number of rows.
this is the code for getting data from the database :
<?php
$accid = $_SESSION['accid'];
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] . "bulk2/" );
include("/config.php");
$con = mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
mysql_query("SET CHARACTER SET utf8");
$res=mysql_query("SELECT * FROM `sent_msgs_history` WHERE `accid` = $accid" ***LIMIT 0,5*** );
if(mysql_num_rows($res)> 0)
{
for($i=0;$i<mysql_num_rows($res);$i++) {
$row=mysql_fetch_assoc($res);
//$de_name = decrypt($key,$iv,$row['rec_name']);
//$de_mobile = decrypt($key,$iv,$row['mobile_number']);
$de_name = $row['senderName'];
$de_length = $row['MessageLength'];
$de_count = $row['MessageCount'];
$de_date = $row['sent_on'];
$de_sender = $row['sent_by'];
?>
<tr>
<td> <?php echo $de_name ;?> </td>
<td> <?php echo $de_length;?> </td>
<td> <?php echo $de_count;?> </td>
<td> <?php echo $de_sender;?> </td>
<td> <?php echo $de_date;?> </td>
</tr>
<?php }?>
</table>
<br>
<br><br> <br>
<?php
}?>
i don't know the number of row , how can i do that ????? please help me >>>