Yes, that's exactly what I was looking for, it works good, but not good ength. There is a problem with the script.
I give you an example:
In the database I have 10 rows full of information, but when I use the script if shows me only 9 of 10. ????? Why
There is the code I use:
<?php
// [test.php]
$sql_svr = "SERVER";
$sql_usr = "USERNAME";
$sql_pwd = "PASSWORD";
$sql_dbs = "DATABASE";
$sql_tbl = "TABLE";
$connection=mysql_connect($sql_svr, $sql_usr, $sql_pwd)or die("<font color=\"#ff0000\">ERROR: Server Not Found</font>");
$database=mysql_select_db("$sql_dbs",$connection);
$limit=4;
$numresults=mysql_query("select * from $sql_tbl order by ID");
$numrows=mysql_num_rows($numresults);
if (empty($offset)) {
$offset=1;
}
$result=mysql_query("select * from $sql_tbl order by ID limit $offset,$limit");
echo"<hr>";
while ($row=mysql_fetch_array($result)) {
$sql_data_content=$row[content];
eval("\$sql_data_content_done = \"$sql_data_content\";");
echo"
<p>
<table width=\"300\" border=\"0\">
<tr>
<td width=\"10%\" bgcolor=\"$body_bgcolor1\" align=\"center\" valign=\"middle\"><font face=\"$font_face\" size=\"$font_size\" color=\"#000000\"><a href=\"mailto:$row[email]\"><img height=\"19\" src=\"/images/board/envelope.gif\" border=\"0\"></a></font></td>
<td width=\"90%\" bgcolor=\"$body_bgcolor1\" align=\"left\"><font face=\"$font_face\" size=\"$font_size\" color=\"#000000\"> <b>$row[name]</b></font></td>
</tr>
<tr>
<td width=\"100%\" bgcolor=\"$body_bgcolor1\" align=\"right\" colspan=\"2\"><font face=\"$font_face\" size=\"$font_size2\" color=\"#000000\">$row[datetime]</font></td>
</tr>
<tr>
<td width=\"100%\" bgcolor=\"$body_bgcolor2\" colspan=\"2\"><font face=\"$font_face\" size=\"$font_size\" color=\"#000000\">$sql_data_content_done</font></td>
</tr>
</table>
</p>";
}
echo"<hr>";
if($offset > $limit){
$newoffset=$offset-$limit;
print "<a href=\"$PHP_SELF?offset=$newoffset\">PREV</a> ";
}
$pages=intval($numrows/$limit);
if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}
for ($i=1;$i<=$pages;$i++) { // loop thru
$newoffset=$limit*($i-1);
print "<a href=\"$PHP_SELF?offset=$newoffset\">$i</a> \n";
}
if ($numrows-$offset > $limit){
$newoffset=$offset+$limit;
print "<a href=\"$PHP_SELF?offset=$newoffset\">NEXT</a><p>\n";
}
?>