Login   Register  
PHP Classes
elePHPant
Icontem

ezSQL

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

  Author  
Picture of Justin Vincent
Name: Justin Vincent <e-mail contact>
Packages: 1 Browse all classes by Justin Vincent Browse all classes by
Country: United Kingdom United Kingdom - PHP jobs in United Kingdom
Age: ???
All time rank: 937 in United Kingdom United Kingdom
Week rank: 269 Down12 in United Kingdom United Kingdom Down


  Detailed description   Download .zip .tar.gz  
ezSQL is a widget that makes it very fast and easy for you to use database(s) within your PHP scripts.

This widget is a php file that you include at the top of your script. Then, instead of using std php database functions listed in the php manual, you use a much smaller (and easier) set of ezSQL functions.

ezSQL can dramatically increase development time and in most cases will streamline your code and make things run faster as well as making it very easy to debug and optimise your database queries.

Please read through these examples to see how easy using databases can be using ezSQL.

-------------------------------------------------------
Example 1
-------------------------------------------------------

// Select multiple records from the database..
$results = $db->get_results("SELECT name, email FROM users");

foreach ( $results as $user )
{
// Access data using object syntax
echo $user->name;
echo $user->email;
}

----------------------------------------------------
Example 2
----------------------------------------------------

// Get one row from the database..
$user = $db->get_row("SELECT name,email FROM users WHERE id = 2");

echo $user->name;
echo $user->email;


----------------------------------------------------
Example 3
----------------------------------------------------

// Get one variable from the database..
$var = $db->get_var("SELECT count(*) FROM users");

echo $var;


----------------------------------------------------
Example 4
----------------------------------------------------

// Insert into the database
$db->query("INSERT INTO users (id, name, email) VALUES (NULL,'Justin','jv@foo.com')");


----------------------------------------------------
Example 5
----------------------------------------------------

// Update the database
$db->query("UPDATE users SET name = 'Justin' WHERE id = 2)");


----------------------------------------------------
Example 6 (for debugging)
----------------------------------------------------

// Display last query and all associated results
$db->debug();


----------------------------------------------------
Example 7 (for debugging)
----------------------------------------------------

// Display the structure and contents of query results (or any variable)
$results = $db->get_results("SELECT name, email FROM users");

$db->vardump($results);


----------------------------------------------------
Example 8
----------------------------------------------------

// Get 'one column' (based on index) from a query..
$names = $db->get_col("SELECT name,email FROM users",0)

foreach ( $names as $name )
{
echo $name;
}

// Get another column from the previous (cached) query results..
$emails = $db->get_col(null,1)

foreach ( $emails as $email )
{
echo $email;
}


----------------------------------------------------
Example 9
----------------------------------------------------

// Map out the full schema of any given database..

$db->select("my_database");

foreach ( $db->get_col("SHOW TABLES",0) as $table_name )
{

$db->debug();
$db->get_results("DESC $table_name");

}

$db->debug();

  Classes of Justin Vincent  >  ezSQL  >  Download .zip .tar.gz  >  Support forum Support forum (23)  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: ezSQL
Base name: mysqldb
Description: Makes using mySQL ridiculously easy (great docs)
Version: -
PHP version: -
License: Artistic License
All time users: 17439 users
All time rank: 35
Week users: 10 users
Week rank: 205 Down
 
  Groups   Rate classes User ratings   Dependents  
  Trackback   Applications   Files Files  

  Groups  
Group folder image Databases Database management, accessing and searching View top rated classes


  User ratings  
Ratings
Utility
Consistency
Documentation
Examples
Tests
Videos
Overall
Rank
All time:
Good (95.6%)
Good (93.5%)
Good (90.9%)
Good (91.3%)
-
-
Sufficient (75.4%)
52
Month:
Not yet rated by the users

  Packages that need this class  
Class Dependency Why it is needed
3SS Data Description Form
Recommended
To retrieve data

  Trackback links  
Link Description
InvisionYourLife.com Development A new version of InvisionYourLife.com went live around Christmas 2008...
mysqli kütüphanesi Evet manual'de, extension listesinde felan görüyorduk ama nedir pek bilemiyorum...
Subtitles with FlowPlayer I recently built a subtitling system for a site that I am working on: khristos.org...

  Applications that use this class  
No application links were specified for this class.
Add link image If you know an application of this package, send a message to the author to add a link here.
  Files folder image Files  
File Role Description
Accessible without login Plain text file ez_demo.php Example Demo that maps out your db schema
Plain text file ez_sql.php Class Main File
Accessible without login HTML file ez_sql_help.htm Doc. This will really help you to understand this

Download all files: mysqldb.tar.gz mysqldb.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.