PHP Classes

ezSQL: Makes using mySQL ridiculously easy (great docs)

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (24)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 75%Total: 17,942 This week: 1All time: 45 This week: 560Down
Version License Categories
mysqldb 1.0.0Artistic LicenseDatabases
Description 

Author

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();

Picture of Justin Vincent
Name: Justin Vincent <contact>
Classes: 1 package by
Country: United Kingdom
Age: ???
All time rank: 1027 in United Kingdom
Week rank: 411 Down12 in United Kingdom Down

  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

 Version Control Reuses Unique User Downloads Download Rankings  
 0%1
Total:17,942
This week:1
All time:45
This week:560Down
User Ratings User Comments (14)
 All time
Utility:95%StarStarStarStarStar
Consistency:93%StarStarStarStarStar
Documentation:90%StarStarStarStarStar
Examples:91%StarStarStarStarStar
Tests:-
Videos:-
Overall:75%StarStarStarStar
Rank:76
 
nice
9 years ago (reza)
80%StarStarStarStarStar
One of the most straight-forward mysql wrappers available.
12 years ago (Tom Carnevale)
80%StarStarStarStarStar
Very useful and easy to use.
13 years ago (Paulo Amaral)
80%StarStarStarStarStar
Easy to use and it appears that I can create applications usi...
14 years ago (M Jason Vertucio)
77%StarStarStarStar
I certainly hope your users are aware of the significant risk...
14 years ago (Daren Schwenke)
27%StarStar
good for querying but would be good to have options to modify...
14 years ago (Thomas Slawer)
52%StarStarStar
With some tweaks, this class is a simple and effective way to...
15 years ago (Juan Prada)
72%StarStarStarStar
Excellent class, as a novice php user this helped with the da...
15 years ago (Dave Munro)
80%StarStarStarStarStar
Awesome, simple package
15 years ago (MGH)
80%StarStarStarStarStar
Great script!!!
15 years ago (sam)
77%StarStarStarStar
this class isn't safe for sql injection, i added a small func...
15 years ago (Andrea Venturi)
80%StarStarStarStarStar
The greatest class for mysql!
15 years ago (Przemek Czekaj)
80%StarStarStarStarStar
Very useful, thanks buddy!
15 years ago (Mario)
80%StarStarStarStarStar
This package was usefull to me, thanks
16 years ago (Abu Bakar Romadhoni bin Kuslan)
75%StarStarStarStar