Jump to content

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

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.