I am working on a project where I use mysql_fetch_assoc to return an associative array.
However, I am puzzled as to why it would return TRUE
I have looked at the PHP manual page, and the only boolean value it should be returning is FALSE, and then only on a fail.
Although I am using a custom set of abstraction classes, it is basically doing this:
$result = mysql_query("SELECT * FROM table WHERE filename = 'test1.jpg'");
var_dump(mysql_fetch_assoc($result)); // bool(true)
Does anyone know why it would be returning TRUE instead of an array?
Update
Well, after trying a few things, I’ve determined its my library, as running the above code returns an associative array. I don’t know why exactly it was returning TRUE, but for now, I am going to stop making things more complicated than they have to be (a problem of mine) and just use mysqli (thanks for the tip, Michael) instead of my own ActiveRecord classes, which apparently don’t work.
Thanks!
Start using mysqli_query mysqli_fetch_assoc, . The old version is soon to be outdated – the new one is better anyways.