HDFilmMaker2112 Posted June 3, 2012 Share Posted June 3, 2012 The following code is giving an error: $check_email_DB = mysqliCOE('zyquo_emotico'); $sanitized_email=mysqli_sanitize($check_email_DB, $register_email); $result = $check_email_DB->query("SELECT COUNT(email) FROM user WHERE email='$sanitized_email'"); $number_rows = $result->fetch_assoc(); if($number_rows!=1){ $error[18]=1; } else{ $error[18]=0; } This is producing a non-object error: Fatal error: Call to a member function fetch_assoc() on a non-object. What's wrong with the above? I pretty much copied it right off the manual on php.ner Is there a better way to get the results from a COUNT query in MySQLi? Link to comment https://forums.phpfreaks.com/topic/263574-how-to-get-data-from-sql-query-that-uses-count-with-mysqli/ Share on other sites More sharing options...
trq Posted June 3, 2012 Share Posted June 3, 2012 Your query is failing for some reason. Do you have any way of checking errors from those objects? Link to comment https://forums.phpfreaks.com/topic/263574-how-to-get-data-from-sql-query-that-uses-count-with-mysqli/#findComment-1350783 Share on other sites More sharing options...
HDFilmMaker2112 Posted June 3, 2012 Author Share Posted June 3, 2012 Would help if I knew my own column names. It's email_address not email. Link to comment https://forums.phpfreaks.com/topic/263574-how-to-get-data-from-sql-query-that-uses-count-with-mysqli/#findComment-1350801 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.