J'ai cette fonction:PDO :: FETCH_ASSOC pas aller chercher tout ce
function get_following($user_id) {
global $conn;
$stmt = $conn->prepare("SELECT * FROM following WHERE `follower_id`=:user");
$stmt->bindParam(':user', $user_id, PDO::PARAM_INT);
$stmt->execute();
$following =$stmt->fetch(PDO::FETCH_ASSOC);
return $following;
}
Le tableau following
ressemble à ceci:
|user_id|follower_id|
| 2 | 5 |
| 3 | 5 |
| 4 | 5 |
Maintenant, le problème est quand je l'appelle en fait la fonction qu'il ne sélectionne une des lignes de la table, où mon follower_id = 5.
Conseil: la lecture d'une page de manuel pour la fonction aide souvent –