Woyano Home - My Friends - My Topics - Inbox - Join - Login
Justin Vincent
Technology, Entrepreneurialism & Rambling

Subscribe to
My Woyano network and Friends list!

Enter your email:

Download ezSQL Database Class (2.05)

Rate this:
By JV (Contact - View My Woyano)
Published Tue 06 Feb 2007, 80070 Views, 33 Comments

ez_sql_2.05.zip
       (60 KB, upload, archive) ~ (right click to download)


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

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

Author

    Justin Vincent

This Item
Feature
Flag as Adult
Flag as Inappropriate
Category: Uploads, Archive
Tags: ezsql, oracle, mysql, php, script, database, class
Geo-tags: london, uk
Share it
Link to this item:
Bookmark this item: RSS Feed

People who liked this item

    33 Comments

  1.  
    sagetips ~ 42 months ago
    0 votes thumbs up thumbs down
    Hi -

    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??
    [ reply ]
    1.  
      JV ~ 42 months ago
      0 votes thumbs up thumbs down
      Best thing to do is get ezsql/mysql/demo.php to work.

      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!
      [ reply ]
      1.  
        sagetips ~ 42 months ago
        0 votes thumbs up thumbs down
        Yes, thanks it works now. It wasn't clear to me that the values in demo.php needed edit.

        Thanks again
        [ reply ]
        1.  
          bkramer ~ 42 months ago
          0 votes thumbs up thumbs down
          JV,
          what is new in version 2.03?
          your build history doc hasn't been updated.
          [ reply ]
          1.  
            MazY ~ 42 months ago
            0 votes thumbs up thumbs down
            The download links appear to be broken. :(
            [ reply ]
            1.  
              alan ~ 41 months ago
              0 votes thumbs up thumbs down
              I had downloaded and tried this files, but where can find the demo for sybase, I need this, Thanks.


              --------------------
              software reviews
              [ reply ]
              1.  
                johntheentrepreneur ~ 40 months ago
                0 votes thumbs up thumbs down
                hi,

                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

                [ reply ]
                1.  
                  johntheentrepreneur ~ 40 months ago
                  0 votes thumbs up thumbs down
                  any help please? with the porblem above?
                  [ reply ]
                  1.  
                    FSDFSDFHSJKGFJLDKFHG ~ 39 months ago
                    0 votes thumbs up thumbs down
                    I'm new to PHP. I've been using this not-so-good php class for simplified mysql usage, and want to migrate to ezSql. Everything has went wel, but I have one question: is it possible to do an "or die" style error reporting on all query functions? (Example, $db-query("insert query here") or die("...") will do the query and then die if I try to do it)
                    [ reply ]
                    1.  
                      muurbloem ~ 38 months ago
                      0 votes thumbs up thumbs down
                      Hello,

                      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

                      [ reply ]
                      1.  
                        tom151 ~ 38 months ago
                        0 votes thumbs up thumbs down
                        Hi JV,
                        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,
                        [ reply ]
                        1.  
                          Dory Spartan ~ 37 months ago
                          0 votes thumbs up thumbs down
                          ezSQL Database Class 2.03 with PostgreSQL support
                          http://postgresql.fortunecity.com/
                          Hope this helps!
                          [ reply ]
                          1.  
                            Selina ~ 32 months ago
                            0 votes thumbs up thumbs down
                            thanks,, very helpful




                            regards, selina
                            [ reply ]
                          2.  
                            topanga ~ 37 months ago
                            0 votes thumbs up thumbs down
                            we are still waiting for some demo.... of this database

                            Regards, Topanga
                            [ reply ]
                            1.  
                              ozyank ~ 36 months ago
                              0 votes thumbs up thumbs down
                              I have not been able to use the variable $db->insert_id successfully. For example, should this work?

                              $sql="INSERT INTO test_mdb_members (".$fields.") VALUES (".$values.")";
                              $results=$db->query($sql);
                              $last_id = $db->insert_id;
                              echo "

                              Records added: ".count($results).". Last ID: ".$last_id."

                              ";
                              [ reply ]
                              1.  
                                ozyank ~ 36 months ago
                                0 votes thumbs up thumbs down
                                I forgot to say. Nothing is displayed for $last_id in the echo statement.
                                [ reply ]
                                1.  
                                  JV ~ 35 months ago
                                  0 votes thumbs up thumbs down
                                  Just a quick note to everyone.

                                  I added support for PHP PDO, and also added postgress and ms-sql to the main distribution.

                                  Thanks for the contributions.

                                  JV
                                  [ reply ]
                                  1.  
                                    Christophe ~ 35 months ago
                                    0 votes thumbs up thumbs down
                                    JV, do you have a public Subversion repository set up for this?
                                    [ reply ]
                                    1.  
                                      greg ~ 34 months ago
                                      0 votes thumbs up thumbs down
                                      On the Constructor on ezSQL_mysql ver.2.04 why did you leave out the function to connect to the Database?
                                      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);
                                      [ reply ]
                                      1.  
                                        Janet Kellman ~ 32 months ago
                                        0 votes thumbs up thumbs down
                                        I'm new to PHP. I've been using this not-so-good php class for simplified mysql usage, and want to migrate to ezSql. Everything has went wel, but I have one question: is it possible to do an "or die" style error reporting on all query functions?
                                        (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
                                        [ reply ]
                                        1.  
                                          Bancer ~ 31 months ago
                                          0 votes thumbs up thumbs down
                                          Hi, I got this error message on my localhost:

                                          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?
                                          [ reply ]
                                          1.  
                                            Jed ~ 8 months ago
                                            0 votes thumbs up thumbs down
                                            I have the same problem. There are coding errors in the ez_sql class that display when E_STRICT is enabled in php.

                                            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.
                                            [ reply ]
                                          2.  
                                            foof ~ 29 months ago
                                            0 votes thumbs up thumbs down
                                            Is there an answer to this problem:
                                            http://www.jvmultimedia.com/portal/node/208

                                            I can't remember my username/password to see the answer!
                                            I have the same problem.
                                            [ reply ]
                                            1.  
                                              Caprice ~ 21 months ago
                                              0 votes thumbs up thumbs down
                                              thanks, I had same problem as well... now it's solved
                                              caprice
                                              [ reply ]
                                            2.  
                                              teapear ~ 28 months ago
                                              0 votes thumbs up thumbs down
                                              hi, i got this error message when using mysql_real_escape_string;

                                              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'");
                                              [ reply ]
                                              1.  
                                                mosphp ~ 28 months ago
                                                0 votes thumbs up thumbs down
                                                hi, I have to thanks for this great class that I use it from 1.26.
                                                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,
                                                [ reply ]
                                                1.  
                                                  mosphp ~ 28 months ago
                                                  0 votes thumbs up thumbs down
                                                  i mean:
                                                  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
                                                  [ reply ]
                                                  1.  
                                                    Terry ~ 28 months ago
                                                    0 votes thumbs up thumbs down
                                                    mosphp:

                                                    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
                                                    [ reply ]
                                                  2.  
                                                    New Member ~ 23 months ago
                                                    0 votes thumbs up thumbs down
                                                    Only one question...are stored procedures executed for this php library? I mean Can this library execute stored procedures? Because I tried to execute one of mine (Call stored(params)) and answer is PROCEDURE stored can't return a result set in the given context
                                                    Any comments? please
                                                    [ reply ]
                                                    1.  
                                                      holtbakk ~ 22 months ago
                                                      0 votes thumbs up thumbs down
                                                      Small question. While I in 'plain' php/mysql do something like "mysql_connect("host", "user", "pw") or die("could not connect");" i cannot find a way to 'die' with ezsql if the DB is not answering. Any tips? Thanx alot!
                                                      [ reply ]
                                                      1.  
                                                        Madalin ~ 5 months ago
                                                        0 votes thumbs up thumbs down
                                                        I use strip_tags,real escape strings and ENT_Quotes to sanitize inputs. I have modified a little the script, but is really useful.

                                                        software reviews
                                                        [ reply ]
                                                        1.  
                                                          Jeff Salam ~ 4 months ago
                                                          0 votes thumbs up thumbs down
                                                          Hi Madalin;

                                                          Im new to php and I was wondering if you could share the script modification with strip_tags,real escape strings and ENT_Quotes to sanitize inputs . thanks
                                                          jeff
                                                          [ reply ]
                                                        2.  
                                                          Jose A. Cely ~ 23 days ago
                                                          0 votes thumbs up thumbs down
                                                          Hi,
                                                          Before, thanks for that great library, i work whith ezsql for 3 years!
                                                          I found small bug, where you have multiple database conections and/or classes. I write an small module for Drupal.
                                                          In my module, $db->query($sql) returns false "randomly" where INSERT, however the insert works fine, after hours of debug my work ( days :$ ), found the "bug" in the line 212 of ez_sql_mysql.php .

                                                          $this->rows_affected = @mysql_affected_rows();

                                                          lack link identifier!, change the line to:

                                                          $this->rows_affected = @mysql_affected_rows($this->dbh);

                                                          And works fine.

                                                          Hope that it helps.

                                                          Cheers,

                                                          Jose A. Cely
                                                          [ reply ]
                                                          1.  
                                                            22 votes thumbs up thumbs down
                                                            This is my two cents...

                                                               
                                                            Hey you know AdGuy always gets the last word! ;)

                                                          Please Login to Add Your Comment   ..or..  

                                                          Replying to comment by