php pdo connects to mysql data to query data_PHP tutorial

WBOY
Release: 2016-07-13 17:04:58
Original
840 people have browsed it

html code





ansys tutorial




php code

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

//Get file binary stream
$filename = "/www.bKjia.c0m/logo.gif";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize ($filename));
fclose($handle);
//Create data table
$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();
}

?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/630802.htmlTechArticlehtmlcode!doctype html public -//w3c//dtd xhtml 1.0 transitional//en http://www .w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml head meta htt...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template