Jump to content

'simple' script problem


matijarma

Recommended Posts

hy everyone

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 :)

Link to comment
Share on other sites

hy guys i have managed to resolve my problem after all.

you are all free to see my gallery on my homepage:

www.matijar.info/index.php?sajt=foto

:)

i will post the source code of the gallery in a short wile, i have to get my comments in order. you are all, ofcourse, free to use the source if you like.

cheers!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.