|
@@ -17,7 +17,7 @@
|
|
|
|
|
|
The Initial Developer of the Original Code is
|
|
The Initial Developer of the Original Code is
|
|
Mark J Crane <[email protected]>
|
|
Mark J Crane <[email protected]>
|
|
- 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 ($this->where) {
|
|
|
|
- $i = 0;
|
|
|
|
- foreach($this->where as $row) {
|
|
|
|
- if ($i == 0) {
|
|
|
|
- $sql .= "where ".$row['name']." ".$row['operator']." '".$row['value']."' ";
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- $sql .= "and ".$row['name']." ".$row['operator']." '".$row['value']."' ";
|
|
|
|
|
|
+ if (isset($this->table) && isset($this->where)) {
|
|
|
|
+ $sql = "delete from ".$this->table." ";
|
|
|
|
+ if ($this->where) {
|
|
|
|
+ $i = 0;
|
|
|
|
+ foreach($this->where as $row) {
|
|
|
|
+ if ($i == 0) {
|
|
|
|
+ $sql .= "where ".$row['name']." ".$row['operator']." '".$row['value']."' ";
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ $sql .= "and ".$row['name']." ".$row['operator']." '".$row['value']."' ";
|
|
|
|
+ }
|
|
|
|
+ $i++;
|
|
}
|
|
}
|
|
- $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() {
|