pages.php?id=$var

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
JustinMs66
Forum Contributor
Posts: 127
Joined: Sun Sep 03, 2006 4:18 pm

pages.php?id=$var

Post by JustinMs66 »

i am attempting to create a website that will display all of my graphic work. i just recently finished creating code to easily a new graphic to the list. it uploads the name, notes, and image to the mysql database, as well as create a thumbnail and saves it as a different jpeg as well. the thumbnail will be shown on the frontpage, and the when you click on it, it will go to the actual page, including a bigger image, as well as the title, author notes, and spaces for comments.

now that i'v explained that, here is my question:
as i explained, i want there to be a different page for each individual graphic. so would the easiest way to be to do it something like:
pages.php?id=$graphicID
and then depending on the number at the end, it will display different graphics. or is their an easier way?
if that is a good way to do it, will someone please point me to a tutorial that explains more about how to set something like that up?
Z3RO21
Forum Contributor
Posts: 130
Joined: Thu Aug 17, 2006 8:59 am

Post by Z3RO21 »

Here is the steps you want. I don't have time to write out an example script, but I hope this helps.

What you want to do is first get the ID. You can do this by

Code: Select all

$ID = $_GET['id'];
Of course you will want to validate this to ensure the end user is not messing with you script.

Once you have the ID then it is a simple SELECT query to grab your information, then the rest is output.

In my opinion this is a decent way. What I do for querying is use ORM (Object Relational Mapping) systems so I don't even gotta fuss with the SQL.
The link for an ORM tut is in my signature if it interests you.
Post Reply