I know this has probably been covered, but I couldn't find excactly what I was looking for when searching. I have a small MySQL database that contains 4 fields (id, name, thumb, image) What I am doing with is is displaying an iframe on the displays an array from thumbnail images($thumb) and what I want to do with that is make it a link that is classified by its id number and opens up in the other iframe where I have the $name and $image fields echoed. I've very new with php, and have been reading through a tutorial on that has gotten me started but I can't get the links to classify themselves by their id numbers, so I'm not sure if I'm doing it right. I'll paste my codes but try not to laugh
left iframe (contains thumbnail images):
Code:
<?
include("protected/dbinfo.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die ("Unable to select database");
$query="SELECT * FROM doors";
$result=mysql_query($query);
$id=$_GET['id'];
$num=mysql_numrows($result);
mysql_close();
$i=0;
while($i < $num){
$thumb=mysql_result($result,$i,"thumb");
?>
<a href="?id=$id" target='doorinfo'>"><img src="http://10.0.0.11/htdocs/images/doors/thumbs/<? echo $thumb; ?>" border="0" /></a> <br />
<?
$i++;
}
?>
this is the other iframe that I want the other information displayed when they click on the thumbnail:
Code:
<?
include("protected/dbinfo.php");
$id=$_GET['id'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die ("Unable to select database");
$query="SELECT * FROM doors WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num){
$name=mysql_result($result,$i,"name");
$image=mysql_result($result,$i,"image");
?>
<center><h1><? echo $name; ?></h1>
<p>
<img src="http://10.0.0.11/htdocs/images/doors/<? echo $image; ?>" border="0" /> <br />
<? $i++;
}
?>
any help or links to tutorials would be greatly appreciated.
Thanks
|