Jump to content

imaginary id's ??


dj-kenpo

Recommended Posts

ok, so I have a photo album script.

right now I grab the photo by it's table ID.

 

this is messy though as if I grab the second photo in the 4th album, it will really be photo_ID 197, etc.

 

I've thought of a way to just say, get image#2 in album #4 but I'm wondering what you guys think.

 

more and more and more and more sql calls, array if statments etc, it all adds up, does this make sense or seem bloated?

 

//photo album

$Count=1;

//get image number

$pic= $_GET["pic"];

 

-do an sql call for ALL images in that folder

 

$sql = "SELECT photo_ID FROM photos WHERE Parent_ID=4";

$result = mysql_query($sql);

while($row = mysql_fetch_array($result))

{

//list out images and count if count = get[image number] then we have the image ID.

$photo_ID=$row["photo_ID"];

if ($Count== $pic){

$imaginary_photo_ID = $photo_ID;

}

$Count++;

}

 

it will work, but there's already sql calls for stuff in the header, footer, settings, etc etc etc and it just keeps adding up. can anyone think of eaither a better way of faking the number or a totally different method?

 

storing the fake image number count in the database won't cut it, as photos get deleted or shuffled in order, so that doesn't seem efficient. but maybe it is? maybe doing one intensive edit loop is better than 1000 little ones?

 

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.