I need to select name
, surname
from users
where username
= column following
inside network_follow
table
the query:
"SELECT * FROM network_follow WHERE following = :f UNION SELECT name, surname FROM users where username = (following)";
php code:
$f = $conexao_pdo->prepare('SELECT * FROM network_follow WHERE following = :f UNION SELECT name, surname FROM users where username = (following)');
$f->bindParam(':f', $db_user);
$f->execute();
while($values = $f->fetch(PDO::FETCH_ASSOC)){
$fvalue = $values['follower'];
$fname = $values['name'];
echo '<center>
<div><a href=""> <img class="rounded-circle" width="45" src="'.get_user_picture($fvalue).'"></img> @'.$fvalue.'</a>
<span style="padding-left: 15px;">'.$fname.'<span>
<div></center>';
}
Resulting to me $fvalue
just fine, but not $fname
for some reasons union select is not working, can somebody help?