<?php // configuration $dbhost = "localhost"; $dbname = "pdo"; $dbuser = "root"; $dbpass = ""; // database connection $conn = new PDO("mysql:host=$dbhost;dbname=$dbname",$dbuser,$dbpass); // new data $title = 'PHP Pattern'; $author = 'Imanda'; $id = 3; // query $sql = "UPDATE books SET title=?, author=? WHERE id=?"; $q = $conn->prepare($sql); $q->execute(array($title,$author,$id)); ?>
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.