powaz Posted May 20, 2007 Share Posted May 20, 2007 need help with paging i have php code: $eilutes = 3; $psl_nr = 1; if(isset($_GET['page'])) { $psl_nr = $_GET['page']; } $nuo = ($psl_nr - 1) * $eilutes; $komentaras="SELECT * WHERE psalis like'%".$psalis."' and issalis like'%".$issalis."' and dID NOT LIKE'".$dID."' LIMIT $nuo, $eilutes ;"; $uzklausa=mysql_query($komentaras,$db); $i=mysql_num_rows($uzklausa); $query="SELECT COUNT(dID) AS numrows FROM kroviniai WHERE psalis like'%".$psalis."' and dID NOT LIKE'".$dID."' ;"; $result = mysql_query($query) or die('Error, query failed'); $row = mysql_fetch_array($result); $eil_sk =$row['numrows']; $max_psl = ceil($eil_sk/$eilutes); if($uzklausa){ while ($row = mysql_fetch_array($uzklausa)){ echo '<tr>'; echo '<td width="30"><div align="center"> <form action="isplestine_paieska_kroviniai.php" method="post" name="form1" onsubmit="naujaslangas(this)"> <input type="hidden" name="id[]" value="'.$row['cID'].'">'.$row['cID'].'</div></td>'; echo '<td width="100"><div align="left"><img src="flags/'.$row["psalis"].'.png"> '.$row["psalis"].'</div></td>'; cho '<td width="80"><div align="left">'.$row["isdata"].'</div></td>';.... echo '<td width="40" align="center"><input type="submit" class="mygtukai" value="info"/></form></div></td>'; } echo '</tr></table>'; } $self = $_SERVER['PHP_SELF']; for($page = 1; $page <= $max_psl; $page++) { if ($page == $pageNum){$nav .= " $page "; } else{$nav .= " <a href=\"$self?page=$page\">$page</a> ";} } $nav; ?> then I'm running page at 1-st time paging is ok, but i'm have the form in same page(search), so then I'm doing search paging wrong... so i thing i need to get another header like (my.page.php) but i don't know haw to do please help me !!!! Link to comment https://forums.phpfreaks.com/topic/52223-help-paging/ Share on other sites More sharing options...
radar Posted May 20, 2007 Share Posted May 20, 2007 What I would do if i were you, it get into using smarty... great templating engine, and they have a pagination plugin for it, that you do 1 query, and it does the rest. Link to comment https://forums.phpfreaks.com/topic/52223-help-paging/#findComment-257647 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.