How to delete records?
1) Write the delete statement: [code language=”php”] $sql = "DELETE FROM `users` WHERE `id`=:id"; [/code] 2) Prepare the query: [code language=”php”] $query = $dbh -> prepare($sql); [/code] 3) Bind the…
Read more »How to use PDO to update the database?
1) Write the regular update statement and again, instead of values, assign the named placeholders. For example: [code language=”php”] $sql = "UPDATE `users` SET `city`= :city, `phone` = :tel WHERE…
Read more »How to use PDO to read data from the database?
1) Write the regular select statement and again, instead of values, put named placeholders. For example: [code language=”php”] $sql = "SELECT * FROM users"; [/code] 2) Prepare the query: [code…
Read more »How to use PDO to insert data into the database?
The SQL code for the users table: [code language=”sql”] CREATE TABLE IF NOT EXISTS users (id int(11) NOT NULL AUTO_INCREMENT, name varchar(60) DEFAULT NULL, phone varchar(12) DEFAULT NULL, city varchar(60)…
Read more »PDO – PHP database extension
PDO – PHP database extension PDO (PHP Data Objects) is a PHP extension through which we can access and work with databases. Though PDO is similar in many aspects to…
Read more »TURN OFF DISPLAY ERROR IN PHP
Method 1 & 2 & 3 https:///…-standards-error-fix Method 4 error_reporting(0); ini_set(‘display_errors’, ‘0’); # don’t show any errors… error_reporting(E_ALL | ~E_STRICT); # …but do log them Few more http:///…-standards-in-joomla…
Read more »