UPDATES VIA   RSS  |  Email Get updates via feedburner Get updates via twitter
Home / Coding / PHP / PHP Error: Call to a member …

PHP Error: Call to a member function fetch_assoc() on a non-object in

Posted on 23. Jun, 2009 by 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:

  1. SQLite, MySQL, PHP: Ternary operator (IF() statement) in MySQL and SQLite
  2. WordPress: Easily Reset Your Account Password Using MySQL and PHP
  3. WordPress: Best SEO iTranslator for WordPress, get free traffic from fully automated plugin script
  4. JavaScript: How to get the index (position within a group) of an object with jQuery?
  5. JavaScript: Send function as a parameter to another function (callbacks)

  • http://Website(optional) Jenny

    Pretty nice post. I just found your site and wanted to say
    that I’ve really enjoyed reading your blog posts. Anyway
    I’ll be subscribing to your blog and I hope you write again soon!

  • http://seopilot.ru/ seopilot

    Спасибо, очень интересный и познавательный материал. Добавил в закладки теперь почаще буду захаживать.

  • http://www.autocadhocasi.com AutoCAD

    Thank you very much for this information. Good post thanks for sharing.

  • Hasan78

    Tüm
    dünyadaki okey oyuncuları ile aynı platform içerisinde sohbet ederek canlı okey
    oynamaya hazır olun. http://www.okey-oyna.com sizi eğlenceye ve heyecana davet ediyor. İnternette görüntülü
    olarak okey oyna, gerçek kişilerle tanış, turnuva
    heyecanını yaşa. Dünyanın en büyük internet oyun portalı içerisine kayıt olun
    ve oynamaya hemen başlayın.