I have been up coding for nearly 24 hours, and it seems that I can't get a simple join statement to work. I know in the morning I'm going to call myself an idiot, but figured I would go ahead and post here in hopes of having it sorted out by the time I wake up I have two tables: category_air and images. The category table (category_air) has one column, which is 'images_id' (a reference to the primary key of the images table). The images table has several columns, primarily id and name. I am attempting to get all of the id's in the category table and then grab all of the image names whose id's correspond to ones found in the category_air table. I've tried several variations below and it doesn't seem to be working: select category_air.image_id, images.id, images.name from category_air inner join images on category_air.image_id = images.id Code (markup): Here is my complete PHP code snippet: $sql = "select category_air.image_id, images.id, images.name from category_air inner join images on category_air.image_id = images.id"; $sql = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($sql)) { print "Name: " . $row['images.name'] . "<br />"; } PHP: It appears to be attempting to print out two rows (as it just prints 'Name:' twice) but nothing is being fetched from the database. Anyone see anything wrong with this code?
DId you try just doing: print "Name: " . $row['name'] . "<br />"; Generally you don't use the table name in the output. Otherwise the Join looks fine.