Home >Backend Development >PHP Tutorial >php pdo connects to mysql data to query data_PHP tutorial
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();
}
?>