var_dump(PDO::getAvailableDrivers());
Output ( this will change based on your PHP installation / support )
array(2) { [0]=> string(5) "mysql" [1]=> string(6) "sqlite" }
Follow the instructions at php.ini here to enable the support. PDO will not work for versions older than PHP 5 ( Check your PHP Version )
Functions | Description |
Installation | How to enable PDO in PHP 5 and above versions |
Connection | Connection to MySQL Database |
Functions | Description | Fetch | Collecting single record |
Records | Multiple records from table |
Functions | Description | Insert | Adding records to table |
Update | Update record |
Delete | Delete records |
Drop | Drop table |
Functions | Description | RowCount | Number of rows affected by delete or update query |
ColumnCount | Number of columns present in a query or table |
Functions | Description | Blob | Managing Binary data using Blob data type |
Upload | Upload photo to add to Blob column of MySQL database |
From a list of records to a single recordWe can display a list of student names by taking data from a table. From this list user can click a single record ( say student name column ) to get full details of the record ( student details ) |
Basic Php MySQL database script using PDO
You should have PHP installed
Database MySQL
Check PDO connection from PHP to MySQL
How to Install Script
Open sql_dump.txt file and use the sql commands to create your tables.
Open config.php and enter your mysql login details.
Open index.php file and check for any error messages
Open any file and use the top menu to navigate different pages
You can delete table or remove all records by using different pages using top menu.
You can re-initiate all tables and records by visiting links at the top menu.
So feel free to experiment with drop table or deleting records.