Hi,
I've found a code from Batman...
But i really don't know how to alter him to suit my needs...
Here's his code :
// limit value for number of records to be shown per page
// query database to find total number of records to display
$limit = 5;
$query_count = "select * from ".$prefix."store_inventory where (description like '%$search%' or title like '%$search%')";
$result_count = mysql_query($query_count);
$totalrows = mysql_num_rows($result_count);
if(empty($page))
$page = 1;
$limitvalue = $page * $limit - ($limit);
$query = "select * from ".$prefix."store_inventory where (description like '%$search%' or title like '%$search%') LIMIT $limitvalue, $limit ";
$result = mysql_query($query) or die("Error: " . mysql_error());
$count_result = mysql_num_rows($result);
// Display links at the top to indicate current page and number of pages displayed
$numofpages = ceil($totalrows / $limit);
echo"<br><p><b>$totalrows</b> result(s) for: \"$search\"</p>";
$from=$limit*$page-$limit+1;
$to=$from + $count_result-1;
// start 123 next>> table
echo "<table align=\"center\" width=\"90%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr><td width=\"50%\" bgcolor=\"$bg_colour\" align=\"left\">";if($numofpages>1){echo"Showing: $from - $to</td><td width=\"50%\" bgcolor=\"$bg_colour\" align=\"right\"><b>Go to page:</b> ";}
// display previous link if page is not 1
if($page != 1){
$pageprev = $page - 1;
echo("<a href=\"$PHP_SELF?page=$pageprev&search=$search\"><< PREV</a> ");
}
// display page nos if not 1
for($i = 1; $i <= $numofpages; $i++){
if($numofpages>1){
if($i == $page)
echo(" ".$i." ");
else
echo(" <a href=\"$PHP_SELF?page=$i&search=$search\">$i</a> ");
}}
// display next page link if there is more than one
if(($totalrows - ($limit * $page)) > 0){
$pagenext = $page + 1;
echo("<a href=\"$PHP_SELF?page=$pagenext&search=$search\">NEXT >></a>");
}
// end 123 next>> table
echo"</td></tr></table><br>";
And here's my code:
mysql_connect("localhost","ussrn","pw");
mysql_select_db(dbname);
$sql="SELECT * FROM sph_fotoboek ORDER BY date";
$res=mysql_query($sql) or die("Error 1:".mysql_error());
while ($ligne = mysql_fetch_object($res))
{
?>
<div align="left">
<table border="0" cellspacing="1" width="473">
<tr>
<td width="89" bgcolor="#009933"><font color="#CFB53B"><b>Naam :</b></font></td>
<td width="233" bgcolor="#EAEAAE"> <a href="mailto:<?php echo $ligne->email; ?>"><font color="#009933"><?php echo $ligne->name; ?></font></a></td>
<td width="131" bgcolor="#009933"><font color="#CFB53B">Datum : <?php echo $ligne->date; ?></font></td>
</tr>
<tr>
<td width="89" bgcolor="#009933"><font color="#CFB53B"><b>Woonplaats :</b></font></td>
<td width="364" bgcolor="#EAEAAE" colspan="2"> <font color="#009933"><?php echo $ligne->city; ?></font></td>
</tr>
<tr>
<td width="89" bgcolor="#009933"><font color="#CFB53B"><b>Foto :</b></font></td>
<td width="364" bgcolor="#EAEAAE" colspan="2"> <a href=fotoboek/<?php echo $ligne->img; ?> border=0><img src="fotoboek/<?php echo $ligne->img; ?>" width="100" border=0></a> </td>
</tr>
</table>
</div>
<br>
<?php
}
mysql_free_result($res);