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 } ?> Quote Link to comment 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']; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.