/** * Returns an Array of Objects by default. * Seems only return an object if a single result. Need to verify. * False on failure? */ $users = $db->get_results("SELECT name, email FROM users");/** * Returns an Object by default * False on failure? */ $user = $db->get_row("SELECT name,email FROM users WHERE id = 2");/** * Returns an Array of values? */ $names = $db->get_col("SELECT name,email FROM users",0)/** * Returns a single value from the DB */ $var = $db->get_var("SELECT count(*) FROM users");/** * General query that doesn't return results */ $bool = $db->query("INSERT INTO users (id, name, email) VALUES (NULL,'justin','jv@foo.com')");// Display last query and all associated results $db->debug();// Display the structure and contents of any result(s) .. or any variable $results = $db->get_results("SELECT name, email FROM users"); $db->vardump($results);// Map out the full schema of any given database and print it out.. $db->select("my_database"); foreach ( $db->get_col("SHOW TABLES",0) as $table_name ) { $db->debug(); $db->get_results("DESC $table_name"); } $db->debug();
$db->get_results – get multiple row result set from the database (or previously cached results)
$db->get_row – get one row from the database (or previously cached results)
$db->get_col – get one column from query (or previously cached results) based on column offset
$db->get_var – get one variable, from one row, from the database (or previously cached results)
$db->query – send a query to the database (and if any results, cache them)
$db->debug – print last sql query and returned results (if any)
$db->vardump – print the contents and structure of any variable
$db->select – select a new database to work with
$db->get_col_info – get information about one or all columns such as column name or type
$db->hide_errors – turn ezSQL error output to browser off
$db->show_errors – turn ezSQL error output to browser on
$db->escape – Format a string correctly to stop accidental malformed queries under all PHP conditions
$db = new db – Initiate new db object.
$db->num_rows – Number of rows that were returned (by the database) for the last query (if any)
$db->insert_id – ID generated from the AUTO_INCRIMENT of the previous INSERT operation (if any)
$db->rows_affected – Number of rows affected (in the database) by the last INSERT, UPDATE or DELETE (if any)
$db->num_queries – Keeps track of exactly how many ‘real’ (not cached) queries were executed during the lifetime of the current script
$db->debug_all – If set to true (i.e. $db->debug_all = true;) Then it will print out ALL queries and ALL results of your script.
$db->cache_dir – Path to mySQL caching dir.
$db->cache_queries – Boolean flag (see mysql/disk_cache_example.php)
$db->cache_inserts – Boolean flag (see mysql/disk_cache_example.php)
$db->use_disk_cache – Boolean flag (see mysql/disk_cache_example.php)
$db->cache_timeout – Number in hours (see mysql/disk_cache_example.php)