Please check out my new weekly podcast techZING!
News and views from the front-line of tech & startups
http://techzinglive.com/
Overview
- ezSQL is a class that makes it ridiculously easy to use mySQL, Oracle8, SQLite (PHP), within your PHP script. Includes lots of examples making it very easy to understand how to work with databases. ezSQL has excellent debug functions making it lightning-fast to see what’s going on in your SQL code. ezSQL can dramatically decrease development time and in most cases will streamline your code and make things run faster.
Features
- ezSQL is a widget that makes it ridiculously easy for you to use PHP-PDO, mySQL, Oracle8, InterBase/FireBird, PostgreSQL, SQLite (PHP), SQLite (C++) or MS-SQL database(s) within your PHP/C++ scripts (more db's coming soon) - now works with codeigniter!
- It is one php file that you include at the top of your script. Then, instead of using standard php database functions listed in the php manual, you use a much smaller (and easier) set of ezSQL functions.
- It automatically caches query results and allows you to use easy to understand functions to manipulate and extract them without causing extra server overhead
- It has excellent debug functions making it lightning-fast to see what's going on in your SQL code
- Most ezSQL functions can return results as Objects, Associative Arrays, or Numerical Arrays
- It can dramatically decrease 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.
- Works with Smarty templating language
- It is a small class and will not add very much overhead to your website.
Download
Download ezSQL completely Free from the download link at the top of this page, also check out EZ Results Paging Class ezSQL's sister class that makes result paging a snip.
Important Note!
For Inerbase/Firebase, PostgreSQL, SQLite (C++), MS-SQL database(s) download version 1.26. Or, even better, help port ezSQL to version two.
Documentation
- Extensive help documentation and examples (N.B. Full docs in download file).
- ezSQL revision/build history
- Article explaining the theory behind ezSQL
ezSQL Forum
Testemonials
- Chris Ray - "I have used ezSQL since version 1.04 and have so much confidence in this database class that I use it (with permission from Justin) as the database engine in a commercial product that I have released recently. To see this fast and easy to use database class in action, you could visit the ReviewCast demo at www.reviewcast.com"
Robin Jackson - "Was in the process of learning about SQl and PHP, the going was slow, that is until ezSQl came along and made things a relative snip. In the process of using ezSQL I also found out more about MySQL and PHP and can now write more natively if I so wished. I found the 'class' not just a usefull tool but also a fabulous assistant to learning."
Luke Hendricks - What a great tool! I trimmed dozens of lines of redundant code out of one of my apps using your object. I can’t wait to build one from the ground up using it.
LL Ceder - "The many examples you provided make it really easy for people to start using your classes immediately."
Will Macdonald - "BRILLIANT work !!! Next time you are in London let me buy you a beer. It just saved me several hours."
Kevin Danenberg - "Your ezSQL class facilitated the rapid development of this database intensive site (www.blbex.com). There were times when it was so ludicrously simple I had to laugh! Especially considering how rich ezSQL is in features. Nicely done!"
Alan Graham - "Coming from a J2EE/Oracle background, I was a complete newcomer to PHP/MySQL when I discovered ezSQL. Great documentation and an exceptionally simple API made this the clear choice for our systems (www.parallel56.com). I've recommended it to numerous others, and they've loved it too. You've found what you're looking for, just download it!!!"
Matthew Hellinger - "I've been using ezSQL from v1.08 and it has become an indispensable part of my programming arsenal. With ezSQL I get projects done 2-3 times quicker and can tackle much larger projects with ease thanks to the great API. Knowing that these projects can be easily moved to different database systems is an added bonus."
Jim O'Halloran's Web Log - "When I first started working with PHP, the lack of a standard database library seemed odd to me. How would I write database independent PHP scripts? But then I discovered ezSQL which wraps up everything nicely for me. Sure, I could have used PEAR DB, or ADOdb, or Metabase or now PEAR MDB? I guess each has their own advantages or disadvantages, but the fact that there is a choice means we can pick the best tool for the job. For what I'm doing right now, thats ezSQL. Why should I use a more bloated DB library when I'm not going to use most of its features?"
Sites Using ezSQL
- www.reviewcast.com - Community review site
- www.blbex.com - Big League Baseball Exchange
- www.acaldra.com - Community site
- www.okyz.com - French Mac, PC, Unix software company
- www.WebspaceEnterprises.com - E-Business development company
- www.polandguangzhou.com - Polish Consulate in China (Commercial and Economic Section)
Author
- Justin Vincent





30 Comments
EZsql looks to fit my needs. But I'm trying to install and am not having luck. The instructions indicate a file "ez_sql_core.php" should be present but it doesn't appear to be in the zip file I download.
Am I missing something??
Just edit the values at the top of the file.
p.s. ez_sql_core.php is in the dir ezsql/shared
Hope this helps!
Thanks again
what is new in version 2.03?
your build history doc hasn't been updated.
--------------------
software reviews
please help me with my ezsql error.
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 33172040 bytes) in /hsphere/local/home/livinise/blobees.com/libs/ez_sql_core.php on line 370
please look at this link for more explanation
http://forums.pligg.com/showthread.php?p=29747
In the file ez_sql_mysql.php I have adapted the following part.
function escape($str)
{
// aanpassing 14-07-2007
// return mysql_escape_string(stripslashes($str));
$str2 = mysql_escape_string(stripslashes($str));
return htmlentities($str2, ENT_QUOTES, 'UTF-8');
}
This extended function gave me the the mixed leters like é and ë.
Maybe someone can use this.
Ubel Jan
I'm converting to XAMPP and PHP5 -- now getting this error - does ezSQL not run on PHP5? Is there some PHP config change that will solve this?
Strict Standards: var: Deprecated. Please use the public/private/protected modifiers in c:XAMPPxamppxamppphp_incez_sql_core.php on line 32
(and repeats for many lines)
Thanks for ezSQL,
http://postgresql.fortunecity.com/
Hope this helps!
regards, selina
Regards, Topanga
I added support for PHP PDO, and also added postgress and ms-sql to the main distribution.
Thanks for the contributions.
JV
My Copy Just Had
$this->dbuser = $dbuser;
$this->dbpassword = $dbpassword;
$this->dbname = $dbname;
$this->dbhost = $dbhost;
So I added
$this->quick_connect($this->dbuser, $this->dbpassword, $this->dbname, $this->dbhost);
(Example, $db-query("insert query here") or die("...") will do the query and then die if I try to do it)
Janet Kellman, software reviews manager
Strict Standards: Declaration of ezSQL_mysql::query() should be compatible with that of ezSQLcore::query() in D:serverfinance_systemtemp213-ez_sql_2.04ezsqlmysqlez_sql_mysql.php on line 263
Strict Standards: Declaration of ezSQL_mysql::escape() should be compatible with that of ezSQLcore::escape() in D:serverfinance_systemtemp213-ez_sql_2.04ezsqlmysqlez_sql_mysql.php on line 263
ezSQL demo for mySQL database run @ 2008-02-26 12:59:26
What is the best way to fix it?
You can correct the errors, at least for the MySQL class, by changing the following in ez_sql_core.php on lines 80 & 90 respectively.
(80) from: function query()
(80) to: function query($query)
(90) from: function escape()
(90) to: function escape($str)
However, for all I know this could break compatibility with other database classes. So I only recommend doing it if you use the MySQL class.
http://www.jvmultimedia.com/portal/node/208
I can't remember my username/password to see the answer!
I have the same problem.
caprice
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:xampphtdocsnewupmmainlogin.php on line 7
Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in C:xampphtdocsnewupmmainlogin.php on line 7
my code:
include_once "include/ez_sql_core.php";
include_once "include/ez_sql_mysql.php";
$db = new ezSQL_mysql('root','','um','localhost');
$username = mysql_real_escape_string($_POST["username"]);
$query = $db->get_row("SELECT * FROM user WHERE Username='$username'");
But, I'm facing a problem that how to do runtime-created function within a function in php, could you please show me some example !
Best,
function aaa(){
..
$result =$db->get_results($array); <-- getting error of Fatal error: Call to a member function get_results() on a non-object in
..
}
thanks
You need to do something like this:
function aaa($sql)
{
global $db;
$result = $db->get_results($sql);
return $result;
}
Hope that it helps.
Cheers,
Terry
Any comments? please
Hey you know AdGuy always gets the last word! ;)