Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/01/2011, 16:48
imRicoh
 
Fecha de Ingreso: enero-2011
Mensajes: 49
Antigüedad: 13 años, 3 meses
Puntos: 0
Dilema con Fetch_Array()

Quiero dibujar un Tree desde una base de datos y para eso uso este codigo

Código PHP:
Ver original
  1. function scanRecordSet($objParent = false)
  2.     {
  3.         $strHtml = "";
  4.         $objPrior = NULL;
  5.         while (($arrThis = $this->objConn->fetchArray()) && (is_object($objParent) ? $objParent->arrProps["level"] < $arrThis["level"] : true))
  6.         {
  7.             $objThis = new createObject($arrThis); ++$this->numIndex;
  8.             $arrNext = $this->objConn->fetchArray();
  9.             $this->objConn->dataSeek($this->numIndex);
  10.             if (is_array($arrNext))
  11.             {
  12.                 $booSubItems = $arrNext["level"] > $arrThis["level"];
  13.                 $this->drawItem($objThis, $booSubItems);
  14.                 if ($booPopup)
  15.                 {
  16.                     $strSubHtml = $this->scanRecordSet($objThis);
  17.                     $objThis->appendChild($strSubHtml);
  18.                 }
  19.             }
  20.             else
  21.             {
  22.                 $this->drawMenu($objThis);
  23.             }
  24.             $strHtml = $strHtml . $objThis->getHtml();
  25.         }
  26.         return $strHtml;
  27.     }

El problema esta cuando hago un
arrThis = fetchArray() // me retorna normal el registro actual
arrNext = fetchArray() // me retorna el siguiente para comparalo con el anterior array
pero al volver hacer el bucle me va avanzando registro como puedo hacer para ir al registro(fila de la tabla) anterior?

Saludos