If I run this query without initializing theproducts variable the code populates the <ul> properly but I get an undefined variable: products in... error. I read in the php manual that when using prepared statements they return an extra (empty) result set as a result of having called the statement itself. Could this be the problem or is it because the HTML renders first, sees the empty product variable and fires off this error because when I initialize $products = "" all is fine. Curious to know exactly what's going on.
line 67: $sql = $db->prepare("SELECT * from item WHERE user_id = '$pid'");
$sql->execute();
$products = "";
while($row = $sql->fetch())
{
$item_id = $row['item_id'];
$user_id = $row['user_id'];
$item_name = $row['item_name'];
$item_description = $row['item_description'];
$date = $row['add_date'];
$image = $row['photopath'];
$products .= "<li><a href='item_view.php?pid=".$item_id."'><img src='$image'
width='50' height='50'/></a> Item ID: $item_id UserID: $user_id NAME: $item_name Added on: $date DESCRIP: $item_description</li>";
in the HTML
<ul>
line 112: <?php echo $products; ?>
</ul>
undefined variableshould tell you at which line it happens