I’m not getting any data, and I’ve checked my dad which should match up
I have two tables, likes and user_follow
I’m trying to tie the two tables by an id.
Table – Column
likes – idlikes, iduser, information
user_follow – iduser_follow, iduser_follower, iduser_following
$following = $dbh -> prepare("SELECT L.* FROM likes L JOIN user_follow F ON F.iduser_following = L.iduser WHERE F.iduser_follower = ?");
$following->execute(array($_SESSION['user_auth']));
while($row_following = $following->fetch(PDO::FETCH_ASSOC)){
$id_1 = $row_following['L.information']; // get id of user that i'm following
echo $id_1;
}
So if i’m following someone, i should be able to display information associated with whomever I’m following.
I don’t get any errors, it just doesn’t echo out anything?
Sample Data
user_follow
iduser_follow iduser_follower iduser_following
1 2 3
2 2 4
likles
idlikes iduser information
1 3 info1
2 3 info2
So, I should output info1 and info2, assuming that $_SESSION[‘user_auth’] = 2, correct?
and fetch value