Skip to content

Commit

Permalink
fix latest, remove rowCount from array
Browse files Browse the repository at this point in the history
  • Loading branch information
lintangtimur committed Oct 30, 2017
1 parent 475e779 commit 0e2d4ae
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public function selectAll($table)
$rowcount = $this->setRow($hasil);
$hasil = $hasil->fetchAll(\PDO::FETCH_CLASS);

$hasil['rowCount'] = $rowcount;

$this->temp = $hasil;

return $this;
Expand Down Expand Up @@ -70,15 +68,14 @@ public function insert($table, array $parameter)
* @param string $query example
* select * from siswa where NIM = ?
* @param array $bindValue value
* @return array|null
* @return array|null|$this
*/
public function RAW($query, array $bindValue)
{
$result = $this->pdo->prepare($query);
$result->execute($bindValue);

$hasil = $this->checkArrayIndex($result->fetchAll(\PDO::FETCH_CLASS));
$hasil['rowCount'] = $this->setRow($result);
$this->temp = $hasil;

return $this;
Expand Down Expand Up @@ -115,12 +112,12 @@ public function first()
*/
public function latest()
{
return $this->temp[count($this->temp) - 2];
return $this->temp[count($this->temp) - 1];
}

/**
* get all result
* @return [type] [description]
* @return mixed get result
*/
public function get()
{
Expand Down

0 comments on commit 0e2d4ae

Please sign in to comment.