Useful PHP class: ezSQL

I first used this class 3 years ago, I found it still to be one of the best php class you can find on the web.

the ezSQL class enables you to use php to connect to many different databases including

  • MySQL
  • MSSQL
  • PostgreSQL

It provides many methods to retrieve single data value, data sets and rows of data.

I especially find the following method useful

// get n number of rows of result set based on your query
// can return a standard object, associate array or numeric (index) array
$db->get_results(string "query string", [OBJECT | ARRAY_N | ARRAY_A]);

// returns a single variable from database
// very useful for select count or other aggregate value SQL statements
$db->get_var(string "query string");

// execute a query without return, gives true/false if the query succeed or fails
// useful for create table, insert, update queries
$db->query(string "query string");

You can download it here

Leave a Reply