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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.