new method for database object
This commit is contained in:
parent
632fd2cb39
commit
f2c37a9dbe
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
|
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||||
*/
|
*/
|
||||||
include "root.php";
|
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(){
|
public function add(){
|
||||||
//connect to the database if needed
|
//connect to the database if needed
|
||||||
if (!$this->db) {
|
if (!$this->db) {
|
||||||
|
|
@ -568,4 +582,4 @@ if (!function_exists('php_right')) {
|
||||||
$database->add();
|
$database->add();
|
||||||
print_r($database->result);
|
print_r($database->result);
|
||||||
*/
|
*/
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue