我在看别人代码,发现传参数 和 字符串中的 单双 引号比较困难我把东东贴上来了,实现基本上都去掉了用了别人的类, 也不知道对不对, 帮忙看看吧,反正总是错, 我把错的地方都贴上来了调用出错的地方
// 第一个
$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],
]);
// 第二个
$datas = $database->insert("sell", [
"brand" => $_POST['brand'],
"style" => $_POST['style'],
"price" => $_POST['price'],
"condition" => $_POST['condition'],
"description" => $_POST['description'],
'image' => "upload/" . $_FILES["file"]["name"]
]);// 第三个
$datas = $database->select(
"user",
["*"],
["where" => "email = ".$_POST['email']]
);
class AAAA
{
protected $database_type = 'mysql'; // For MySQL, MSSQL, Sybase
protected $server = 'localhost';
protected $username = 'username';
protected $password = 'password'; // For SQLite
protected $database_file = ''; // Optional
protected $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()
{
}
}php数据库
// 第一个
$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],
]);
// 第二个
$datas = $database->insert("sell", [
"brand" => $_POST['brand'],
"style" => $_POST['style'],
"price" => $_POST['price'],
"condition" => $_POST['condition'],
"description" => $_POST['description'],
'image' => "upload/" . $_FILES["file"]["name"]
]);// 第三个
$datas = $database->select(
"user",
["*"],
["where" => "email = ".$_POST['email']]
);
class AAAA
{
protected $database_type = 'mysql'; // For MySQL, MSSQL, Sybase
protected $server = 'localhost';
protected $username = 'username';
protected $password = 'password'; // For SQLite
protected $database_file = ''; // Optional
protected $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()
{
}
}php数据库
2.将所有[] 改成 array()