DrTrans Posted August 24, 2009 Share Posted August 24, 2009 $query2 = "COUNT * FROM property WHERE Owner_ID = '$ownerid'"; $result2 = mysql_query($query2); print"<b>Amount of Properties Owned:</b> $result2"; Basically i want it to count how many times it finds that match and display a number. Quote Link to comment Share on other sites More sharing options...
merck_delmoro Posted August 24, 2009 Share Posted August 24, 2009 try this $query2 = "SELECT * FROM property WHERE Owner_ID = '$ownerid'"; $result2 = mysql_query($query2); echo "<b>Amount of Properties Owned:</b>".count($result2); Quote Link to comment Share on other sites More sharing options...
DrTrans Posted August 24, 2009 Author Share Posted August 24, 2009 That gives a value of "1" but i know in the database there are 7 records. Quote Link to comment Share on other sites More sharing options...
kickstart Posted August 24, 2009 Share Posted August 24, 2009 Hi Try this:- $query2 = "SELECT COUNT(*) FROM property WHERE Owner_ID = '$ownerid'"; $result2 = mysql_query($query2); if ($row(mysql_fetch_array($result2))) print"<b>Amount of Properties Owned:</b> ".$row[0]; All the best Keith Quote Link to comment Share on other sites More sharing options...
merck_delmoro Posted August 24, 2009 Share Posted August 24, 2009 my mistake the one that I count is the query not its records inside the query the Post DrTrans was correct Quote Link to comment Share on other sites More sharing options...
DrTrans Posted August 24, 2009 Author Share Posted August 24, 2009 Neither of these solutions have worked Quote Link to comment Share on other sites More sharing options...
DrTrans Posted August 24, 2009 Author Share Posted August 24, 2009 in responce to kick: Fatal error: Function name must be a string Quote Link to comment Share on other sites More sharing options...
kickstart Posted August 24, 2009 Share Posted August 24, 2009 Hi Err, doh. $query2 = "SELECT COUNT(*) FROM property WHERE Owner_ID = '$ownerid'"; $result2 = mysql_query($query2); if ($row = mysql_fetch_array($result2)) print"<b>Amount of Properties Owned:</b> ".$row[0]; Sorry. All the best Keith Quote Link to comment Share on other sites More sharing options...
DrTrans Posted August 24, 2009 Author Share Posted August 24, 2009 Thanks man, I completely didnt even notice the = was missing either.. Im sitting here like WTF Thanks .. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.