Home >Backend Development >PHP Tutorial >php pdo connects to mysql data to query data_PHP tutorial

php pdo connects to mysql data to query data_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:04:58854browse

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...
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