desjardins2010 Posted March 25, 2014 Share Posted March 25, 2014 $user_query = "SELECT * FROM `referrals`"; $user_querys = $con -> query($user_query); $count_query = $user_query -> num_rows; if ($count_query !=0) { while ($row = $user_querys -> fetch_assoc()) { $id = $row['id']; $REG_DATE = $row['regdate']; $username = $row['username']; $refd_user = $row['refd_user']; $commission = $row['commission']; $acct_status = $row['acct_status']; anyone tell me why this Trying to get property of non-object is happening on line $user_querys = $con -> query($user_query); Link to comment https://forums.phpfreaks.com/topic/287257-trying-to-get-property-of-non-object/ Share on other sites More sharing options...
mac_gyver Posted March 25, 2014 Share Posted March 25, 2014 $con isn't an instance of your database object. it is either something else (a boolean...) or it doesn't exist at all (a null...) in the program scope where you are trying to use it. Link to comment https://forums.phpfreaks.com/topic/287257-trying-to-get-property-of-non-object/#findComment-1473812 Share on other sites More sharing options...
desjardins2010 Posted March 25, 2014 Author Share Posted March 25, 2014 I include connection file at the top this page that sets my connection $con = mysqli_connect("$host","$user","$password","$database"); Link to comment https://forums.phpfreaks.com/topic/287257-trying-to-get-property-of-non-object/#findComment-1473813 Share on other sites More sharing options...
trq Posted March 25, 2014 Share Posted March 25, 2014 Then your connection is failing. You should always check that $con is what your expecting it to be before just going ahead and blindly using it. Link to comment https://forums.phpfreaks.com/topic/287257-trying-to-get-property-of-non-object/#findComment-1473815 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.