I currently am building a small and simple referral system. However I am having trouble trying to return how many referrals one single user has. When a new user registers it stores in a column called "referid" and that ID in there correspond to the ID of the username who referred him.
However, upon attempting to find how many times that user's ID is mentioned in the "referid" column and then echoing it, I get this error:
Catchable fatal error: Object of class PDOStatement could not be converted to string in /home/refined/public_html/refer.php on line 30
I cant understand what's actually causing this. I did a quick google and all I could see was that PDO isn't compatible with strings or something. I haven't used PHP and MYSQL together that much before so I'm not sure how to "not" use PDO.
<?php
$checknumber = $odb -> prepare("SELECT COUNT('referid') FROM `users` WHERE `ID` = :ID");
$checknumber -> execute(array(':ID' => $_SESSION['ID']));
echo($checknumber);
?>
Any help is very much appreciated.