|
Using PHP to Interact with a MySQL Database
Understanding the Different MySQL Database Extensions
What is a PHP database extension?
A PHP database extension is a standard PHP extension which specifically manages database connectivity
What are the MySQL database extensions?
mysql, mysqli, and PDO MySQL
What is the "mysqlnd" MySQL Native Driver?
"mysqlnd" is not used directly when developing your website: it is a library which is used by the other PHP MySQL database extensions
Why is the "mysql" extension still included with PHP?
Although there is no longer support for the "mysql" extension, it is included for backwards compatibility. Eventually this extension will no longer be available.
What is the difference between pdo_mysql and mysqli?
Both extensions are highly rated, and each extension has its ardent supporters.
Why was PDO chosen for the examples used in this course?
PDO offers a more streamlined set of commands which can also be used with other database technologies such as Oracle, Microsoft SQL Server and postgres
What is the difference between the PDO and the PDOStatement classes?
The PDO class represents the actual database connection. The PDOStatement class pertains to fetch results
What are examples of reading a table using mysqli and PDO?
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass); foreach($dbh->query('SELECT * FROM users') as $row) { echo implode(':',$row); } $dbh =new mysqli('localhost', $user, $pass, 'test'); foreach($dbh->query('SELECT * FROM users') as $row) { echo implode(':',$row); }
|
|