Skip to content

Commit

Permalink
fixed an issue where returning an empty array would cause a script to…
Browse files Browse the repository at this point in the history
… think it returned false
  • Loading branch information
keverw committed Sep 23, 2012
1 parent 272f565 commit 8b04ec9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions PastaDB.php
@@ -1,7 +1,7 @@
<?php
/**
* @project PastaDB
* @version 0.2
* @version 0.3
* @url https://github.com/keverw/PastaDB
* @about A powerful yet simple database abstraction layer library
**/
Expand Down Expand Up @@ -109,7 +109,16 @@ public function query($string)
}
}
$result->close();
return $records;

if (count($records) > 0) //if more than 0 record, return records
{
return $records;
}
else //else return true, you should always use $db->numRows before trying to do a foreach loop or count on the result.
{
return true;
}

}
else
{
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
PastaDB 0.2
PastaDB 0.3
=======

Work with pasta, then we'll make the spaghetti! PastaDB aims to be a powerful yet simple database abstraction layer library.
Expand Down

0 comments on commit 8b04ec9

Please sign in to comment.