Fork me on GitHub

mysql_fetch_array adodb equivelent  Bottom

  • Hi there,

    could someone tell me how to convert this loop to work with adodb? I tried to do it with $res->GetArray(); but something is lost as it won't work as expected... so what is a good method to mimic mysql_fetch_array with adodb?

    while($root = mysql_fetch_array($res)){

    $root["prefix"] = $this->get_prefix($root['position']);
    $this->c_list[$root['id']] = $root;

    if($RootPos == $root['id'] AND $id != 0 AND $collapsed != ""){
    $this->list_by_id($id);
    continue;

    }else{

    // lets check if there is sub-categories
    if($collapsed == "" AND $id==0){
    $has_children = $this->has_children($root['position']);
    if($has_children == TRUE) $this->get_children($root['position'],0);
    }}}

    TIA,

    -Lobos

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • Not sure if this is what you're looking for, but this method

    Code

    SetFetchMode(ADODB_FETCH_ASSOC);
    tells the ADODB connection object to return associative arrays.
  • yes I understand this, and tried it as well... thanks

    -Lobos

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • Lobos,

    Try the GetAssoc method of adodb.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Thanks Mark, I will keep this in mind but I haven't got the time to convert the rest of the class to adodb... the native PHP mysql functions will have to suffice for the moment... the class I am working with has been a bit tricky and took too much of my time already, but at least now I have unlimited category depth ;)

    -Lobos

    --
    -Lobos
    Professional PHP Framework Services: Concept, Development and Deployment
  • Hi,

    good method to mimic mysql_fetch_array() is $res->FetchRow()

    Thanks

This list is based on users active over the last 60 minutes.