Call to a member function rowCount() on a non-object

后端 未结 3 1232
一生所求
一生所求 2021-01-27 05:07

Im having a problem with my query. I recently switched to PDO, which is kind of new to me. Now i need to use JOIN in my query to get data from another table without making two e

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-27 05:29

    Change your query with this one:

    $query = "SELECT * FROM `friends` as F INNER JOIN `users` as U ON `F.friendID` = `U.id` WHERE `F.userID` = '{$sess_user}' AND `F.request` = '0'";
    

    And add this to your connection, it will show you the errors:

     $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Set Errorhandling to Exception
    

提交回复
热议问题