Stick with the ezSQL format… it’ll be much easier.
Something like this (using foreach
instead of while
):
$query = "SELECT * FROM $bbdb->menu
WHERE set = 'inactive' ORDER BY order ASC";
$r = $bbdb->get_results( $query );
foreach( $r as $rw ) {
// now mess with $rw
echo $rw->database_row . "<br>n";
}
Something that might be helpful would be to browse the source of the ezSQL class in /wp-includes/wp-db.php
The latest from Justin Vincent, the author
http://www.woyano.com/jv/ezsql
The version used in bbPress and WordPress
https://trac.wordpress.org/browser/trunk/wp-includes/wp-db.php
It might help you… you’d be able to see where mysql_query
is begin used, and how to use the ezSQL format best.
I think the reason you’re running into problems with mysql_fetch_array
is because it’s already used.
Not sure on that one though… I would have to check.
Also, what might cause an error: $bbdb->query
will not return anything at all. $bbdb->get_results
needs to be used for multi-dimensional array data, $bbdb->get_row
or $bbdb->get_col
need to be used for single array data, and $bbdb->get_var
needs to be used for non-array/string data. $bbdb->query
is used for inserting data, the others are used for retrieving it.
Someone correct me if I’m wrong, but I’m pretty positive that’s how it goes.
ezSQL is lovely. It certainly takes the pain out of MySQL data manipulation.
So I guess that makes the answer to your question “Neither.” $bbdb->get_results
should do the trick.
And sorry for the screed.