SleepTight Posted December 2, 2010 Share Posted December 2, 2010 Hello, I have been trying to make this work for a while but nothing gives. I'm a bit of a PHP noob, but not even a teacher at school could help me. What I need is something like this page: http://marcandshawn.glrdmd.eu/ian/designers2.php?d=2 So when you click on a thumbnail, you see the bigger image above it, but stay on the same page. My code: <?php include('connection.php'); $query="SELECT * FROM person"; $result=mysql_query($query); ?> ^ reestablishing connections. some html after that. and for the chosen main image: <?php while($row = mysql_fetch_array( $result )) { echo "<img src='uploads/$row[image1]' style='max-width:300px;'/>"; } ?> ^ doesn't work. row[image1] contains the images. <?php { while($row = mysql_fetch_array( $result )){ echo "<a href='index.php?id=$row[id]' style='width:100px; height:100px;'/><img src='uploads/$row[thumb]' style='width:125px; height:90px; border:0px;' /></a>"; } } ?> Supposed thumbnails. If someone could help, it would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 2, 2010 Share Posted December 2, 2010 A basic example of the logic behind that process: if( isset($_GET['s']) && !empty($_GET['s']) ) { switch ($_GET['s']) { case 1: echo "<img src=\"image1.jpg\" title=\"Image1\"><br>"; break; case 2: echo "<img src=\"image2.jpg\" title=\"image2\"><br>"; break; default: echo "<img src=\"default.jpg\" title=\"default image\"><br>"; } } else { echo "<img src=\"default.jpg\" title=\"default image\"><br>"; } ?> <!-- LINKS FROM THUMBNAILS --> <a href="?s=1"><img src="thumb1.jpg"></a><br> <a href="?s=2"><img src="thumb2.jpg"></a> Quote Link to comment Share on other sites More sharing options...
SleepTight Posted December 2, 2010 Author Share Posted December 2, 2010 Not exactly what I wanted, but it works. At least i'm getting somewhere now. Thanks! The problem is, I have to type each thumbnail individually, and to change it I must edit the php file. What I want is that it grabs the images from the database, and where I can simply adjust the order and amount there. 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.