Skip to content

Commit

Permalink
feat: add count
Browse files Browse the repository at this point in the history
  • Loading branch information
reiyanyan committed Oct 17, 2021
1 parent 984d856 commit 8ce7cb6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/functions/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ function assets($files)
}

function dd($data){
$data = var_dump($data);
highlight_string("<?php\n " . var_export($data, true) . "?>");
echo '<script>document.getElementsByTagName("code")[0].getElementsByTagName("span")[1].remove() ;document.getElementsByTagName("code")[0].getElementsByTagName("span")[document.getElementsByTagName("code")[0].getElementsByTagName("span").length - 1].remove() ; </script>';
die();
}
}

function debug($var,$show = false) {
if($show) { $dis = 'block'; }else { $dis = 'none'; }
Expand Down
16 changes: 16 additions & 0 deletions core/libraries/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,4 +428,20 @@ private function _gettype($var)
if (is_int($var)) return 'i';
return 'b';
}

/**
* Get the number of records in the result set
* @return int
*/
/**
* @method count
*
* Used to get the number of records in the result set
*
* example:
*
*/
public function count() {
return count($this->query($this->sql)->fetchAll());
}
}

0 comments on commit 8ce7cb6

Please sign in to comment.