Page 1 of 1

pages.php?id=$var

Posted: Tue Jan 16, 2007 2:41 pm
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?

Posted: Tue Jan 16, 2007 3:21 pm
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.