Reply
newb help with php linking
Old 06-19-2007, 03:17 PM newb help with php linking
Average Talker

Posts: 20
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
dpcamp is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 06-19-2007, 04:12 PM Re: newb help with php linking
Average Talker

Posts: 20
nevermind.. i'm a retard! i didn't add
$id=mysql_result($result, $i, "id");
to the loop and didn't link to the page right..
dpcamp is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to newb help with php linking
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.36452 seconds with 12 queries