nerdpowah23
New Member
- Messages
- 14
- Reaction score
- 0
- Points
- 0
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)){
$name = $row['item_name'];
echo "you have a $name";
}
} else {
echo"You have no items.";
}
?>
<?php
} else {
?>
<?php
}
?>When I try to echo out the name, it doesnt echo anything. Any ideas?
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)){
$name = $row['item_name'];
echo "you have a $name";
}
} else {
echo"You have no items.";
}
?>
<?php
} else {
?>
<?php
}
?>When I try to echo out the name, it doesnt echo anything. Any ideas?