FIxes
This commit is contained in:
parent
a1717228bc
commit
295dd1f9f6
1 changed files with 7 additions and 5 deletions
12
src/WPDO.php
12
src/WPDO.php
|
|
@ -24,6 +24,8 @@ class WPDO {
|
|||
|
||||
public $last_query;
|
||||
|
||||
public $field_delimiter='`';
|
||||
|
||||
//static public $conn=false;
|
||||
|
||||
public function __construct($table) {
|
||||
|
|
@ -94,9 +96,9 @@ class WPDO {
|
|||
|
||||
$fields=$this->check_fields($fields);
|
||||
|
||||
$str_fields=implode('`, `', $fields);
|
||||
$str_fields=implode("{$this->field_delimiter}, {$this->field_delimiter}", $fields);
|
||||
|
||||
$query='select `'.$str_fields.'` from '.$this->table->name.' '.$where_sql;
|
||||
$query="select {$this->field_delimiter}".$str_fields."{$this->field_delimiter} from ".$this->table->name." ".$where_sql;
|
||||
|
||||
$this->sth=$this->conn->prepare($query);
|
||||
|
||||
|
|
@ -194,9 +196,9 @@ class WPDO {
|
|||
|
||||
}
|
||||
|
||||
$final_fields=implode('`, `', $fields);
|
||||
$final_fields=implode("{$this->field_delimiter}, {$this->field_delimiter}", $fields);
|
||||
|
||||
$query='insert into '.$this->table->name.' (`'.$final_fields.'`) VALUES ('.implode(',', array_fill(0, count($fields), '?')).')';
|
||||
$query='insert into '.$this->table->name." ({$this->field_delimiter}".$final_fields."{$this->field_delimiter}) VALUES (".implode(',', array_fill(0, count($fields), '?')).')';
|
||||
|
||||
$this->sth=$this->conn->prepare($query);
|
||||
|
||||
|
|
@ -218,7 +220,7 @@ class WPDO {
|
|||
|
||||
foreach($fields as $field) {
|
||||
|
||||
$final_fields[]='`'.$field.'`=?';
|
||||
$final_fields[]="{$this->field_delimiter}".$field."{$this->field_delimiter}=?";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue