Here is a complete example of MySQLi DataBase connection class, it's most simple yet powerful example.
How to connect MySQL (MariaDB) with php using MySQLi OPP base PHP extension
With this application you can export your apache access log files to mysql database for further analytics .
Here is very basic mariaDB connection with PHP
Here is a working example of how to post multiple forms with PHP and Ajax