Forum Moderators: coopster
What I'm asking for help with is linking these 100 image pages to one another (and the first and last ones to the main page) with next and previous buttons. Ideally what I'd like after this is all done is to be able to upload some new pics each week, add the php pages for them, add their records to the database, and have the next/previous links automatically just "work" integrating the new images with all the old images.
This would be easy if the photo id field (which is also the primary key for the table) held all consecutive numbers (say 1-100), as I could just add or subtract 1 from the ID of the current photo, and I'd be set. The problem is, any time a photo is deleted from the database, a gap is created in the autonumbered photo_ID field, and the +1 or -1 thing just won't work, I don't think. I know what I'm trying to do should be easy -- I'm new to PHP, but I'm still pretty sure this is something I know HOW to do, I just can't think of the way to do it.
Any ideas? Does this make any sense?
Thanks for any help...
Dan
<?
$photo-id=1;
include("shared-photo-code.php");
?>
I know I could have just one file and do something like photos.php&id=1, photos.php&id=2, etc, but I am trying to avoid urls with dynamic query strings attached. I also want to use filenames that are descriptive of the content on the page.
This also seems (to me) a lot easier than using mod_rewrite.
Am I totally off my rocker?
Am I totally off my rocker?
I did something like this way back in my early html days, but without php or a database. Each document was hand coded for the next, or the previous. What a pain, but somehow fulfilling too.
Today I might do it differently. The Next/Prev links would be forms with hidden values; values retrieved from the database. Then I could write a single document, and on form submission the document would be refreshed with the correct pic, as well as any unique page titles, descriptions, etc., all stored in a table.
So, while it might be redundant to create a lot of very similar pages, it's doable and no indication of the position on your rocker. Do what you can today - in a few weeks/month/years you'll know enough to do it all over again - some other way.