o0ozinkyo0o Posted October 15, 2013 Share Posted October 15, 2013 (edited) 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 October 15, 2013 by o0ozinkyo0o (see edit history) Link to comment Share on other sites More sharing options...
tuk66 Posted October 15, 2013 Share Posted October 15, 2013 Use executeS() function. Link to comment Share on other sites More sharing options...
o0ozinkyo0o Posted October 15, 2013 Author Share Posted October 15, 2013 Thanks for your reply. I used "return Db::getInstance()->executeS($sql)" instead of "return Db::getInstance()->getRow($sql)" but system said: "The product has been deleted". Link to comment Share on other sites More sharing options...
o0ozinkyo0o Posted October 15, 2013 Author Share Posted October 15, 2013 executeS() and getRow() also return Array but executeS() not result Product... Do anyone know this issue??? Link to comment Share on other sites More sharing options...
Recommended Posts