Nathan Riley
asked on
mysqli returning single result
I'm trying to convert some code over to mysqli from my sql but getting the error:
Fatal error: Call to a member function fetch_assoc() on a non-object in /home/prod/public_html/das hboard/lef tsidebar.p hp on line 8
Not sure what I'm doing wrong, just trying to pull the count number. Below is my code.
Fatal error: Call to a member function fetch_assoc() on a non-object in /home/prod/public_html/das
Not sure what I'm doing wrong, just trying to pull the count number. Below is my code.
//Project Count
$sql1 = "select count(p.id) as projecttotal from projects p inner join projectassoc pa on p.id = pa.project_id where pa.user_id = $userid";
$result1 = $db->query($sql1);
$row1 = $result1->fetch_assoc();
echo $row1['projecttotal'];
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Heh, it's been a long day. Had an issue with the connection to DB. All working now thanks.
Great! Thanks for the points, ~Ray
ASKER