alexarpad2003 Posted November 3, 2010 Report Posted November 3, 2010 Am codul :<?phpif (isset($_GET['startrow']) or is_numeric($_GET['startrow'])){$startrow = (int)$_GET['startrow'];}@require("aaa.php");$q='select * from table where bbb="ccc" limit '.$startrow.', 5';$rez=$db->query($q);for($i=1;$i<=$rez->num_rows-0;$i++) {$row=$rez->fetch_object();$pret_lei=ceil($row->pret*$_SESSION['EUR']);$out='<table width="530" cellspacing="5" cellpading="0" border="0"><tr><td width="90" style="border: 1px solid #c5c5c5;font-size: 14px" align="center"><img width="70" height="60" src="http://aaa/'.$row->cod.'.jpg"></td><td width="30"></td><td width="230" style="font-size: 15px" align="left"><b>'.$row->marca.'</b><br><font style="color:#555">'.$row->denumire.'</font></td><td width="110" style="font-size: 14px" align="center"><font style="color:#555">'.$row->pret.' € / buc</font><br><font style="color:#000">( '.$pret_lei.' lei )</font></td></tr></table>';echo $out."";}echo '<a style="color:#000;text-decoration:none" href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow-5).'"><<</a><a style="color:#000;text-decoration:none" href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+5).'">>></a>';?>Numai ca href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow-5) si href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+5) imi duc valori de -5 si +5 pana la "infinit" chiar daca nu mai afiseaza nimic pe pagina. Vreau ca atunci cand nu mai sunt valori de afisat sa dispara >>Cum fac ? Quote
plm Posted November 3, 2010 Report Posted November 3, 2010 nu ma pricep dar cred ca if (isset($_GET['startrow']) or is_numeric($_GET['startrow'])){$startrow = (int)$_GET['startrow'];}aici trebuie un else... nuj sigur. in rest nu am vazut nimic special (chiar nu ma pricep. daca gresesc nu ma injura) Quote
jesus Posted November 3, 2010 Report Posted November 3, 2010 (edited) <?phpif (isset($_GET['startrow']) or is_numeric($_GET['startrow'])){$startrow = (int)$_GET['startrow'];}@require("aaa.php");$q='select * from table where bbb="ccc" limit '.$startrow.', 5';$rez=$db->query($q);for($i=1;$i<=$rez->num_rows-0;$i++) {$row=$rez->fetch_object();$pret_lei=ceil($row->pret*$_SESSION['EUR']);$out = '<table width="530" cellspacing="5" cellpading="0" border="0"><tr><td width="90" style="border: 1px solid #c5c5c5;font-size: 14px" align="center"><img width="70" height="60" src="http://aaa/'.$row->cod.'.jpg"></td><td width="30"></td><td width="230" style="font-size: 15px" align="left"><b>'.$row->marca.'</b><br><font style="color:#555">'.$row->denumire.'</font></td><td width="110" style="font-size: 14px" align="center"><font style="color:#555">'.$row->pret.' € / buc</font><br><font style="color:#000">( '.$pret_lei.' lei )</font></td></tr></table>';echo $out."";}$q='select * from table where bbb="ccc" limit ' . ($startrow-5) . ', 5';$rez=$db->query($q);if($rez->num_rows) echo '<a style="color:#000;text-decoration:none" href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow-5).'"><<</a>';$q='select * from table where bbb="ccc" limit ' . ($startrow+5) . ', 5';$rez=$db->query($q);if($rez->num_rows) echo '<a style="color:#000;text-decoration:none" href="'.$_SERVER['PHP_SELF'].'?startrow='.($startrow+5).'"><<</a>;?> Edited November 3, 2010 by jesus Quote
alexarpad2003 Posted November 4, 2010 Author Report Posted November 4, 2010 Merci jesus. Inca o intrebare daca se poate, cum pot face sa si genereze << 1 2 3 4 >>in functie de cate pagini sunt ? Sau le pun singur, numai ca nu stiu ce valoare sa dau hrefurilor de la numere. Inca o data merci. Quote