Jump to content

Help With Join Code Please


justlukeyou

Recommended Posts

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

$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'];
}
  
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.