From f2c37a9dbe8be4e48da3a618e05bb9c9be159e5d Mon Sep 17 00:00:00 2001 From: luis daniel lucio quiroz Date: Sat, 21 Jun 2014 04:59:25 +0000 Subject: [PATCH] new method for database object --- resources/classes/database.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/resources/classes/database.php b/resources/classes/database.php index 4a7e9b02d6..ba4843f233 100644 --- a/resources/classes/database.php +++ b/resources/classes/database.php @@ -22,6 +22,7 @@ Contributor(s): Mark J Crane + Luis Daniel Lucio Quiroz */ include "root.php"; @@ -341,6 +342,19 @@ include "root.php"; } } + // Use this function to execute complex queries + public function execute(){ + //echo $sql; + $prep_statement = $this->db->prepare($sql); + if ($prep_statement) { + $prep_statement->execute(); + return $prep_statement->fetchAll(PDO::FETCH_ASSOC); + } + else { + return false; + } + } + public function add(){ //connect to the database if needed if (!$this->db) { @@ -568,4 +582,4 @@ if (!function_exists('php_right')) { $database->add(); print_r($database->result); */ -?> \ No newline at end of file +?>