Jump to content

Get All Rows in Database.


Recommended Posts

Hi all, 

I'm newbie. And i have a issue about how to get row data in 1 table.

In Class DB have getRow() function. This function only get first Row in table. 

Code of function: 

/**
* getRow return an associative array containing the first row of the query
* This function automatically add "limit 1" to the query
*
* @param mixed $sql the select query (without "LIMIT 1")
* @param bool $use_cache find it in cache first
* @return array associative array of (field=>value)
*/
public function getRow($sql, $use_cache = true)
{
if ($sql instanceof DbQuery)
$sql = $sql->build();


$sql .= ' LIMIT 1';
$this->result = false;
$this->last_query = $sql;
if ($use_cache && $this->is_cache_enabled && ($result = Cache::getInstance()->get(md5($sql))))
{
$this->last_cached = true;
return $result;
}


$this->result = $this->query($sql);
if (!$this->result)
return false;


$this->last_cached = false;
$result = $this->nextRow($this->result);
if ($use_cache && $this->is_cache_enabled)
Cache::getInstance()->setQuery($sql, $result);
return $result;
}
 
 
 
Now i want to modify it to get all record in table or only get Row 2nd, Row 3rd...
Anybody help me?? Thanks all a lot. 
Edited by o0ozinkyo0o (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...