JustinMs66@hotmail.com Posted January 16, 2007 Share Posted January 16, 2007 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:[b][color=red]pages.php?id=$graphicID[/color][/b]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? Quote Link to comment Share on other sites More sharing options...
scott212 Posted January 16, 2007 Share Posted January 16, 2007 it's fairly simple really, you've already done the hard partsif you have the entries in a database you would do a SELECT statement withan asterisk (*) for an identifier. Here is a great tutorial to get things from your database.http://www.tizag.com/mysqlTutorial/mysqlfetcharray.phpOther than that, you were on the right track. Loop over the array and print your links into the thumbnails or list or whatever. For the html you can do like you suggested, for the source of the href tag, use:<?echo "<a href=\"page.php?image=".$array[$n]."\">Link to $array[$n]</a>\n";?>Then on the page you link to place at the beginning something like:<?if (isset($_GET['image'])) { $image = $_GET['image'];}?>and then later on down the page where you want the image to be displayed, just use:<img src="<? echo $image; ?>" />I've done something just like this on my personal page www.scottwillmanvfx.com you can check out my urls Quote Link to comment Share on other sites More sharing options...
JustinMs66@hotmail.com Posted January 19, 2007 Author Share Posted January 19, 2007 ok awesome, thank you for that help, but when you have this code:<?if (isset($_GET['image'])) { $image = $_GET['image'];}?>how is it knowing which image to get?and i want it to show a variety of images, the URL's of which, are in MySql tables Quote Link to comment Share on other sites More sharing options...
scott212 Posted January 22, 2007 Share Posted January 22, 2007 sorry for the delay... the value of $_GET['image'] is whatever follows the = in the url. (page.php?image=1234.jpg) You can define how you want it to relay the message any way you wish, but if page.php?image=1234.jpg is the url, then $_GET['image'] equals 1234.jpg. Saying $image=$_GET['image']; makes $image equal to 1234.jpg as well. Then you can just pop a directory path on the front of $image and put it in an html image tag. you don't have to use $image, you could just use the GET statement, but I think it looks better the other way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.