Jump to content

LEFT JOIN issue


Far Cry

Recommended Posts

So I have a user_items table that has:

userid (So it keeps track of who has the item)

item_id

 

However, I also have an items table that has:

item_id

item_name

item_description

item_type

item_desc

item_cost

item_sell_value

 

<?php require("styles/top.php"); ?>

<?php
if(isLoggedin($valid)){
?>
<center><h1>Your Items</h1></center>
<?php
$query = mysql_query("SELECT items.item_id FROM items LEFT JOIN user_items ON
items.item_id=user_items.item_id WHERE user_items.userid='$userid'");
$numrows = mysql_num_rows($query);
if($numrows > 0){
while($row = mysql_fetch_assoc($query)){
$row['item_name'] = $name;
echo "you have a $name";
  } 
} else {
echo"You have no items.";
}

?>


<?php
} else {
?>


<?php
}
?>

When I try to echo out the name, it echos out the database name instead. Any ideas?

 

 

Link to comment
https://forums.phpfreaks.com/topic/240398-left-join-issue/
Share on other sites

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.