<?php
// configuration
$dbhost = "localhost";
$dbname = "pdo";
$dbuser = "root";
$dbpass = "";
// database connection
$conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass);
// query
$sql = "SELECT id,title,author,cover FROM books2";
$q = $conn->prepare($sql);
$q->execute();
$q->bindColumn(1, $id);
$q->bindColumn(2, $title);
$q->bindColumn(3, $author);
$q->bindColumn(4, $cover, PDO::PARAM_LOB);
while($q->fetch())
{
file_put_contents($id.".jpg",$cover);
echo "$title, $author, <img src='".$id.".jpg'> <br/>";
}
?>
Related Posts
Get the client IP address using PHPThe simplest way to get the visitor’s/client’s IP address is using the $_SERVER['RE[...]
How to use PHP & Multiple Input Text Field/TextboxExample 1 php_multiple_textbox1.php <html> <head> <title>ShotDev.Com Tutoria[...]
string to url slug convert in phpFunction: <?php function create_slug($string, $ext='.html'){ $replace = '-'; &[...]
php Pagination with mysqlTo start with you’ll see that we have our database connection file which we’re including into the[...]
Create Secure Registration Form in PHP/MySQLBy secured we mean that we need to sanitize the data that is passed to our script in order to [...]
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.