hy everybody
i'm having a problem with what should be a simple script to generate a photo gallery. i altered it a little for this showcase, but you'll get the picture i hope
here's the code...
<table align="center" border="0">
<?php
if ($_REQUEST["pictures"]>30)
$pi = 30;
else
$pi = $_REQUEST["pictures"];
$p = $pi;
$o = $_REQUEST["start"];
while ($p%5!=0 || $p>5)
{
echo"<tr>";
for ($i=$o; $i<=$pi && $i<=$o+4; $i++)
echo "<td align='center' height='75' width='90'> <a href='/galerija/slike/Slika_" . $i . ".jpg'> <img src='/galerija/slike/TN/Slika_" . $i . ".jpg' width='90' height='75' border='0'> </a> </td>";
echo"</tr>";
$p-=5;
$o+=5;
if ($p<=5)
{
for ($i=$o; $i<=$pi && $i<=$o+4; $i++)
echo "<td align='center' height='75' width='90'> <a href='/galerija/slike/Slika_" . $i . ".jpg'> <img src='/galerija/slike/TN/Slika_" . $i . ".jpg' width='90' height='75' border='0'> </a> </td>";
break;
}
}
echo "</tr>";
echo "<tr><td><a href='/index.php?sajt=galerija&pocetna=" . $_REQUEST["start"]+30 . "&slike=" . $_REQUEST["pictures"]-30 . "'>Next 30 pictures</a></td></tr>";
?>
</table>
as you can see in the begining of the file i'm loading the total number of pictures and picture number to start with. i want to show 30 pictures per page, so if the quantity is above that, i'm making it show 30 pictures and then a link to the same page with different picture number and picture start paramaters. don't get confused with "index.php?sajt=galerija" beacouse i'm including a "master" file on my index.php which then depending on the argument "sajt" includes another needed .php file. first time the gallery is opened - it's done with a static link witch is taking parameters "picture" and "start" from mysql. but that's of no concirn wright now, beacouse the gallery works ONCE => it shows FIRST 30 pictures as it should, but when the link "Next 30 pictures" is used (which the script makes correctly as it should), the gallery shows empty.
so, the main problem here is, i think the "start" variable. WHY cant it start at "31" or any other number? i also tried to staticly make a start argument=27 or 31 or 54. each time the gallery turns out empty. i'm trying to figure out this bug for days now, and running out of patience and, mostly important, ideas. if anyone can help me, i would be eternaly gratefoul!
thank you very much in advance 🙂