Update database.php
Changes for database -> delete() keeping for the moment for backwards compatibility.
This commit is contained in:
parent
26fd3f6bb7
commit
03180c9018
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Copyright (C) 2010 - 2015
|
Copyright (C) 2010 - 2016
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
@ -473,30 +473,34 @@ include "root.php";
|
||||||
unset($sql);
|
unset($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete(){
|
public function delete() {
|
||||||
//connect to the database if needed
|
//connect to the database if needed
|
||||||
if (!$this->db) {
|
if (!$this->db) {
|
||||||
$this->connect();
|
$this->connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete from the database
|
//delete from the database
|
||||||
$sql = "delete from ".$this->table." ";
|
if (isset($this->table) && isset($this->where)) {
|
||||||
if ($this->where) {
|
$sql = "delete from ".$this->table." ";
|
||||||
$i = 0;
|
if ($this->where) {
|
||||||
foreach($this->where as $row) {
|
$i = 0;
|
||||||
if ($i == 0) {
|
foreach($this->where as $row) {
|
||||||
$sql .= "where ".$row['name']." ".$row['operator']." '".$row['value']."' ";
|
if ($i == 0) {
|
||||||
|
$sql .= "where ".$row['name']." ".$row['operator']." '".$row['value']."' ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql .= "and ".$row['name']." ".$row['operator']." '".$row['value']."' ";
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$sql .= "and ".$row['name']." ".$row['operator']." '".$row['value']."' ";
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
}
|
||||||
|
//echo $sql."<br>\n";
|
||||||
|
$prep_statement = $this->db->prepare($sql);
|
||||||
|
$prep_statement->execute();
|
||||||
|
unset($sql);
|
||||||
|
unset($this->where);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
//echo $sql."<br>\n";
|
|
||||||
$prep_statement = $this->db->prepare($sql);
|
|
||||||
$prep_statement->execute();
|
|
||||||
unset($sql);
|
|
||||||
unset($this->where);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function count() {
|
public function count() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue