Join tables

From: Date: Thu, 28 Feb 2002 09:34:27 +0000
Subject: Join tables
Groups: php.db 
Request: Send a blank email to php-db+get-17356@lists.php.net to get a copy of this message
Hi all, Ok first I have figured out my question on storing an image path. my question now is on joining data from two tables. wt_users has two fields (cols) called uid and pid, uid refers to the user pid refers to the users pet image_data has a field called id which refers to the image path id in image_data has the same value as id in wt_users 1 1 These two queries are what are needed to get the image to display: $pet = mysql_query("select id from wt_users where uid={$session["uid"]}"); $ret = mysql_query($pet); $query = "select binary_data,filetype from image_data where id=$id"; $result = @mysql_query($query); I'm using echo "<img src=\"petdata.php?id= this should correspond with both id's \">"; to display the image how do I join the two tables so that the id's match and give the correct image? And again thanks in advance for your help Regards Jennifer Downey P.S. I have looked at the mysql manual and a few tutorials. None of them helped or worked.

« previous php.db (#17356) next »