I am trying to put values inside my database but i am not able to achieve through this as i am getting an error constantly .
ERROR: Call to a member function fetch_object() on a non-object
Code:
require '../connect.inc.php';
$result = $mysqli->query("SELECT COUNT(user_email) as usercount FROM registered_users WHERE user_email=$email");
$user_count = $result->fetch_object()->usercount; //will return 0 if user doesn't exist
connect.inc.php connects to the database.Above code throws an error at usercount.
My question is what is am i doing wrong ?
Note : It has been marked as duplicate for this question When to use single quotes, double quotes, and backticks in MySQL but i don't think it has any problem in quotes and backticks.