PHP parameter string syntax error
I am reading other people's code and find it difficult to pass parameters and single or double quotation marks in strings.
I pasted Dongdong, and basically removed the implementation.
I used other people's classes, and I don't know if it's right or not. let's take a look at it. it's always wrong. I 've pasted all the wrong places.
Call error
// The first $ database = new AAAA (['database _ type' => 'mysql', 'database _ name' => 'web _ paris_station ', 'server' => 'localhost', 'username' => 'root', 'password' => 'root', 'charset' => 'utf8 ', 'option' => [PDO: ATTR_CASE => PDO: CASE_NATURAL],]); // The second $ datas = $ database-> insert ("ignore ", ["brand" = >$ _ POST ['brand'], "style" = >$ _ POST ['style'], "price" = >$ _ POST ['price'], "condition" = >$ _ POST ['condition'], "description" = >$ _ POST ['description'], 'image' => "upload /". $ _ FILES ["file"] ["name"]); // The Third $ datas = $ database-> select ("user", ["*"], ["where" => "email = ". $ _ POST ['email ']);
class AAAA{protected $database_type = 'mysql';// For MySQL, MSSQL, Sybaseprotected $server = 'localhost';protected $username = 'username';protected $password = 'password';// For SQLiteprotected $database_file = '';// Optionalprotected $charset = 'utf8';protected $database_name = '';protected $option = array();public function __construct($options){}public function query($query){}public function exec($query){}public function quote($string){}protected function array_quote($array){}protected function data_implode($data, $conjunctor, $outer_conjunctor = null){}public function where_clause($where){}public function select($table, $columns, $where = null){}public function insert($table, $data){}public function update($table, $data, $where = null){}public function delete($table, $where){}public function replace($table, $columns, $search = null, $replace = null, $where = null){}public function get($table, $columns, $where = null){}public function has($table, $where){}public function count($table, $where = null){}public function max($table, $column, $where = null){}public function min($table, $column, $where = null){}public function avg($table, $column, $where = null){}public function sum($table, $column, $where = null){}public function error(){}public function last_query(){}public function info(){}}
Reply to discussion (solution)
The array () is abbreviated as [], which is only available in php5.4.
1. upgrade PHP to version 5.4.
2. change all [] to array ()