It supports {@link http://dev.mysql.com/doc/refman/5.0/en/commit.html transactions} and provides ways for caching
query results either by saving cached data on the disk, or by using {@link http://memcached.org/about memcache}.
Provides a comprehensive debugging interface with detailed information about the executed queries: execution time,
returned/affected rows, excerpts of the found rows, error messages, etc. It also automatically
{@link http://dev.mysql.com/doc/refman/5.0/en/explain.html EXPLAIN}'s each SELECT query (so you don't miss those keys
again!).
It encourages developers to write maintainable code and provides a better default security layer by encouraging the
use of prepared statements, where arguments are escaped automatically.
The code is heavily commented and generates no warnings/errors/notices when PHP's error reporting level is set to
E_ALL.
Visit {@link http://stefangabos.ro/php-libraries/zebra-database/} for more information.
For more resources visit {@link http://stefangabos.ro/}
public static function database() { require_once __DIR__ . '/Zebra_Database/Zebra_Database.php'; $connection = new Zebra_Database(); $connection->debug = true; $connection->connect('localhost', 'spalmer', 'Spalm04350', 'alpha'); //$connection->connect('localhost','root','','alpha'); $connection->set_charset(); return $connection; }
<body> <p> Prior to running this example you must first download and install the <a href="http://dev.mysql.com/doc/index-other.html"> <em>world</em></a> test database from MySQL's website.<br> Then, you must edit this file (example.php) and change the settings of <em>host</em>, <em>user name</em>, <em>password</em> and <em>database</em> to match your configuration. </p> <?php // THIS EXAMPLE IS VERY BRIEF! // CHECK THE DOCUMENTATION TO SEE WHAT METHODS ARE AVAILABLE! // include the wrapper class require '../Zebra_Database.php'; // create a new database wrapper object $db = new Zebra_Database(); // turn debugging on $db->debug = true; // connect to the MySQL server and select the database $db->connect('', '', '', ''); $db->set_charset(); // let's work with a country $country = 'Romania'; // get the country's code $country_code = $db->dlookup('Code', 'country', 'Name = ?', array($country)); // get all the cities for the country code $db->query(' SELECT Name FROM city