tags:

views:

178

answers:

1

Hi,

I've been through all the answers for this error, but something weird happens in my case. I have:

$result = $mysqli->query("SELECT * FROM table");
while ($row = $result->fetch_assoc())
{
    // data echoed here
}

I have 3 different behaviors of this:

1.On one page this works perfectly 2.On another page it throws the: Call to a member function fetch_assoc() on a non-object 3.On an empty test page I've just set, where no other code is (except include to $mysqli = new mysqli('host', 'user', 'pass', 'db'); it works, but throws this at me:

Notice: Trying to get property of non-object

Thanks for looking & hopefully helping

A: 

Thanks guys. Special thank you to Lekensteyn - this solved my issue.

What I did is simply reopen the connection before the new query, and now it works.

Ramon