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 »