Posted On: Jan 05, 2021
To connect to a MySQL database in Fat-FRee FRamework follow these syntaxes:
$db=new\DB\SQL('mysql:host=localhost;port=3306;dbname=mysqldb','username','password'); Connecting to a SQLite database would look like: $db=new \DB\SQL('sqlite:/path/to/db.sqlite');
The 4th parameter is an array of options you can use to set additional PDO attributes: $options = array( \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, // generic attribute \PDO::ATTR_PERSISTENT => TRUE, // we want to use persistent connections \PDO::MYSQL_ATTR_COMPRESS => TRUE, // MySQL-specific attribute ); $db = new \DB\SQL('mysql:host=localhost;port=3306;dbname=mysqldb','username','password', $options);
Never Miss an Articles from us.
The Fat-Free is a powerful, open-source, and easy-to-use PHP micro-framework that is designed to help to build fast dynamic and robust web applications. It is distributed under the GNU General Public ...
Few features of Fat-Free Framework are listed below:URL router Cache engine Support for multilingual applications plug-ins that extend its functionality as well as data mappers for SQL and NoSQ...
Minimum system requirement to install Fat-Free Framework with APACHE Web-Server are listed below:PHP 5.4 or higher PCRE 8.02 or higher GD library (for Image plug-in) CURL, sockets or stream ext...