PHP Error: Call to a member function fetch_assoc() on a non-object in
Posted on 23. Jun, 2009 by Dragos in Coding, PHP
If you get this error: Call to a member function fetch_assoc() on a non-object in … , it means that you have an error in your mysql syntax. Supposing that $mysqli is your database connection object, put echo $mysqli->error; just before the line you’re getting the error on.
$mysqli=new mysqli(HOST,USER,PASS,DB);
$mQuery=$mysqli->query('select `data` from `this_table` where `id`=1');
echo $mysqli->error; //echoes that column `data` does not exist in table `this_table`
$row=$mQuery->fetch_assoc(); //gives error as the column `data` is in table `that_table`, not in table `this_table`
$mysqli->close();
Translate this post
Related posts:
- SQLite, MySQL, PHP: Ternary operator (IF() statement) in MySQL and SQLite
- WordPress: Easily Reset Your Account Password Using MySQL and PHP
- WordPress: Best SEO iTranslator for WordPress, get free traffic from fully automated plugin script
- JavaScript: How to get the index (position within a group) of an object with jQuery?
- JavaScript: Send function as a parameter to another function (callbacks)
-
http://Website(optional) Jenny
-
http://seopilot.ru/ seopilot
-
http://www.autocadhocasi.com AutoCAD
-
Hasan78










































