justlukeyou Posted June 5, 2012 Share Posted June 5, 2012 Hi, I have tried to join a number of times before and I am struggling again. It echoes: office Resource id #3 Office is the search term. But it wont echo the name field from the table. Any ideas? <?php echo $room = mysql_real_escape_string($_GET['room']); echo $query = mysql_query("SELECT `name` FROM `productdbase` JOIN `furniture_groups` ON (`furniture_groups`.`long_name` = `productdbase`.`furniture_group`) WHERE `room` = '$room'"); echo($query_row = mysql_fetch_assoc($query)); { ?> <?php echo $row['name']; ?> <?php } ?> Link to comment https://forums.phpfreaks.com/topic/263696-help-with-join-code-please/ Share on other sites More sharing options...
Barand Posted June 5, 2012 Share Posted June 5, 2012 $query is a result set (hence the Resource #3) and needs processing <?php $room = mysql_real_escape_string($_GET['room']); $query = mysql_query("SELECT `name` FROM `productdbase` JOIN `furniture_groups` ON (`furniture_groups`.`long_name` = `productdbase`.`furniture_group`) WHERE `room` = '$room'"); while ($query_row = mysql_fetch_assoc($query)) { echo $query_row['name']; } ?> Link to comment https://forums.phpfreaks.com/topic/263696-help-with-join-code-please/#findComment-1351361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.