Hi i am bit confused on how to fetch my data from database because i have 2 tables namely
credentials and info
Now I am using the credential table for the login purpose only but the username is I used for getting the information from table info like this
$user_id = $_SESSION['user_session'];
$stmt = $db_con->prepare("SELECT * FROM credentials WHERE user_id=:user_id");
$stmt->execute(array(":user_id"=>$user_id));
$userRow=$stmt->fetch(PDO::FETCH_ASSOC);
$bigoid = $userRow['username'];
$sql = "SELECT * FROM member WHERE bigoid=:bigoid";
$query= $db_con->prepare($sql);
$query->execute(array(':bigoid' => $bigoid));
Now the problem is that this while loop
while($row=$query->fetch(PDO::FETCH_ASSOC))
{
$bigoname = $row['bigoname'];
$bigoid = $row['bigoid'];
$name = $row['name'];
$address = $row['address'];
$cellphonenumber = $row['cellphonenumber'];
$emailaddress = $row['emailaddress'];
$facebooklink = $row['facebooklink'];
$content = $row['content'];
$agency = $row['agency'];
$code = $row['code'];
}
is not getting that informations it just says
Undefined variable
all of them those who are inside the clause of the while loop
#EDIT
when i am trying to echo them on my html like this
<?php
echo $bigoname;
?>
it says undefined . Also the other variables like address,email etc.