Is there any database method for fetch_row
#1
In quite a lot of my plugins for SMF and Joomla I use fetch row as this is the most efficient to use within my functions and classes. It appears the closest with myBB is fetch_array which is slightly different to what I need.

Any suggestions?

Basically I would use it as

function whatever($params) {

do some stuff
run a query

return mysql_fetch_row($query);
}
Reply
#2
Why wouldn't you want it as an associative array?
Reply
#3
Because it means a very large rewrite of code I had already written.

Also it seems to fail at the moment with the assoc array, even though the query is valid.

simple_query prefixes everything with mybb which doesn't work as I am pulling from a non-mybb table
Reply
#4
Well there is no fetch_row function for MyBB, what isn't working with fetch_array()? Just use $db->query() instead then.
Reply
#5
It's ok I will just do the assoc array. It's more out of laziness than anything else. but in the long run assoc array is cleaner
Reply
#6
just use the $db->query() functionality. That returns a query object that you can pass to fetch row

function whatever($params) 
{
    global $mybb, $db;

    //do some stuff

    //run query
    $query = $db->query("write your SQL statement here");

    return mysql_fetch_row($query);
}
Lost interest, sold my sites, will browse here once in a while. It's been fun.
Reply
#7
Thanks to you both.

I decided to go down the assoc array path. I was just being lazy really
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)