<?php // configuration $dbhost = "localhost"; $dbname = "pdo"; $dbuser = "root"; $dbpass = ""; // database connection $conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass); // new data $title = "ZEND FRAMEWORK TUTORIAL"; $author = "PHP Everyday"; $cover = fopen('7.png','rb'); // query $sql = "INSERT INTO books2 (title,author,cover) values(?,?,?)"; $q = $conn->prepare($sql); $q->bindParam(1, $title); $q->bindParam(2, $author); $q->bindParam(3, $cover, PDO::PARAM_LOB); $q->execute(); ?>
Related Posts
Get the client IP address using PHP
The simplest way to get the visitor’s/client’s IP address is using the $_SERVER['RE[...]
How to use PHP & Multiple Input Text Field/Textbox
Example 1 php_multiple_textbox1.php <html> <head> <title>ShotDev.Com Tutoria[...]
string to url slug convert in php
Function: <?php function create_slug($string, $ext='.html'){ $replace = '-'; &[...]
php Pagination with mysql
To start with you’ll see that we have our database connection file which we’re including into the[...]
Create Secure Registration Form in PHP/MySQL
By 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.