链接数据库
$host = 'localhost';
$charset = 'utf8';
$dbname = 'dsw';
$user = 'root';
$password = 'root';
$dsn = sprintf('mysql:host=%s;dbname=%s;charset:%s',$host,$dbname,$charset);
1、链接数据库
$pdo = new PDO($dsn,$user,$password);
2、查询操作
$sql = "select * form table where id=?";
$stmt = $pdo->prepare($sql);
$stmt->bindValue($id);
$stmt->execute();
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!