PDO::FETCH_ASSOC not fetching everything

后端 未结 1 917
日久生厌
日久生厌 2020-12-12 01:25

I have this function:

function get_following($user_id) {
 global $conn;
 $stmt = $conn->prepare(\"SELECT * FROM following WHERE `follower_id`=:user\");
 $         


        
相关标签:
1条回答
  • 2020-12-12 01:49

    $following will have to be an array of rows. You are actually only fetching the first row. Fetch it using PDOStatement::fetchAll(), like this:

    $following = $stmt->fetchAll(PDO::FETCH_ASSOC);
    
    0 讨论(0)
提交回复
热议问题