Hi there,
i am trying to make a pagination for my portofolio site.
i got into the some problems which i cant solved, so i came here to seek for help.
Very strange output of links, not working at all.
It doesnt limit results, it shows me all results.
Can any1 help with this ?
Please dont send me to some site tutorials, been there already.
Here is my script source:
<?php
if (isset($_GET['kat']) && isset($_GET['kat'])) {
echo '<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="0"><img name="box_upleft" src="prazan/box_upleft.gif" width="10" height="30" border="0" alt="portofolio"></td>
<td width="94%" align="center" valign="middle" background="prazan/box_r1_c2.gif"><div align="left"></div></td>
<td width="0"><img name="box_upright" src="prazan/box_upright.gif" width="6" height="30" border="0" alt="portofolio"></td>
</tr>
<tr>
<td background="prazan/box_left.gif"> </td>
<td width="100%" bgcolor="#6A5B5B"> <p>';
//$queryp=mysql_query("Select * from portofolio where category='$_GET[kat]' $kat,5");
echo "<table width=100% border=0>\n";
echo "<tr><td >Project thumb</td><td ><div>Project Name</div></td><td ><div>Client name</div></td><td ><div>Url</div></td></tr>";
//initialize the start to 0
if(!$kat) $kat=0;
//mysql queries
$result = mysql_query("select * from portofolio limit $kat,5");
$result2 = mysql_query("select * from portofolio");
//find the number of total rows in the portofolio total
$numrows = mysql_num_rows($result2);
// results in the while loop
while ($rowp=mysql_fetch_array($result2)){
echo "<tr><td align='center'> <a href='index.php?client=$rowp[id]'><img src='porto/images/$rowp[photo]' border=0 align=\"left\"></a></td>";
echo "<td>$rowp[name]</td><td>$rowp[client]</td><td><a href='$rowp[url]' target=\"_blank\">Visit the site</a></td></tr>\n";
}
echo "</table><br>\n";
//put next prev
if ($kat > $numrows)
{
// in this part of the script, very strange output, not link
// whats wrong here
echo "<A HREF=\"<? $php_self ?>?rowstart=<? echo $kat-5;?>\">< Previous Page </A>";
}
if($kat+5<$numrows)
{
// in this part of the script, very strange output, not link
// whats wrong here
echo "<A HREF=\"<? $php_self ?>?rowstart=<? echo $kat+5;?>\">< Next Page </A>";
}
echo '
</p> </td>
<td background="prazan/box_right.gif"><img name="box_right" src="prazan/box_right.gif" width="6" height="48" border="0" alt="portofolio"></td>
</tr>
<tr>
<td><img name="box_downleft" src="prazan/box_downleft.gif" width="10" height="5" border="0" alt="portofolio"></td>
<td background="prazan/box_down.gif"><img name="box_down" src="prazan/box_down.gif" width="79" height="5" border="0" alt="portofolio"></td>
<td><img name="box_downright" src="prazan/box_downright.gif" width="6" height="5" border="0" alt="portofolio"></td>
</tr>
</table>';
}
?>