Home  >  Article  >  php教程  >  php pdo连接mysql数据查询数据

php pdo连接mysql数据查询数据

WBOY
WBOYOriginal
2016-06-13 10:08:09917browse

html代码

 





ansys教程


php pdo连接mysql数据查询数据

php代码

$db = new sqlite3('mysql教程itedb.db');

//获取文件2进制流
$filename = "/www.bKjia.c0m/logo.gif";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize ($filename));
fclose($handle);
//创建数据表
$db->exec('create table person (idnum text,name text,photo blob)');

$stmt = $db->prepare("insert into person values ('41042119720101001x', '张三',?)");
$stmt->bindvalue(1, $contents, sqlite3_blob);
$stmt->execute();

$pdo = new sqlite3('mysqlitedb.db');
$results = $pdo->query('select * from person');
while ($row = $results->fetcharray()) {
ob_start();
header("content-type: image/jpg");
echo $row['photo'] ;
ob_end_flush();
}

?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PDO 查询mysql数据库Next article:php 生成excel文件