Compare commits
No commits in common. "78e1422a9df152c42db0baea8769542c948bfbbb" and "9ea2a28f95356ca7c1b3562fe87a8291b4956b93" have entirely different histories.
78e1422a9d
...
9ea2a28f95
1 changed files with 5 additions and 7 deletions
12
src/WPDO.php
12
src/WPDO.php
|
|
@ -24,8 +24,6 @@ class WPDO {
|
||||||
|
|
||||||
public $last_query;
|
public $last_query;
|
||||||
|
|
||||||
public $field_delimiter='`';
|
|
||||||
|
|
||||||
//static public $conn=false;
|
//static public $conn=false;
|
||||||
|
|
||||||
public function __construct($table) {
|
public function __construct($table) {
|
||||||
|
|
@ -96,9 +94,9 @@ class WPDO {
|
||||||
|
|
||||||
$fields=$this->check_fields($fields);
|
$fields=$this->check_fields($fields);
|
||||||
|
|
||||||
$str_fields=implode("{$this->field_delimiter}, {$this->field_delimiter}", $fields);
|
$str_fields=implode('`, `', $fields);
|
||||||
|
|
||||||
$query="select {$this->field_delimiter}".$str_fields."{$this->field_delimiter} from ".$this->table->name." ".$where_sql;
|
$query='select `'.$str_fields.'` from '.$this->table->name.' '.$where_sql;
|
||||||
|
|
||||||
$this->sth=$this->conn->prepare($query);
|
$this->sth=$this->conn->prepare($query);
|
||||||
|
|
||||||
|
|
@ -196,9 +194,9 @@ class WPDO {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$final_fields=implode("{$this->field_delimiter}, {$this->field_delimiter}", $fields);
|
$final_fields=implode('`, `', $fields);
|
||||||
|
|
||||||
$query='insert into '.$this->table->name." ({$this->field_delimiter}".$final_fields."{$this->field_delimiter}) VALUES (".implode(',', array_fill(0, count($fields), '?')).')';
|
$query='insert into '.$this->table->name.' (`'.$final_fields.'`) VALUES ('.implode(',', array_fill(0, count($fields), '?')).')';
|
||||||
|
|
||||||
$this->sth=$this->conn->prepare($query);
|
$this->sth=$this->conn->prepare($query);
|
||||||
|
|
||||||
|
|
@ -220,7 +218,7 @@ class WPDO {
|
||||||
|
|
||||||
foreach($fields as $field) {
|
foreach($fields as $field) {
|
||||||
|
|
||||||
$final_fields[]="{$this->field_delimiter}".$field."{$this->field_delimiter}=?";
|
$final_fields[]='`'.$field.'`=?';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue