Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Internet > HTTP (WWW)

    Mysql Done Right 0.24

    Download button

    No screenshots available
    Downloads: 237  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Daren Schwenke | More programs
    LGPL / FREE
    October 20th, 2009, 06:09 GMT [view history]
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    Mysql Done Right description

    A PHP class for MySQLi utilizing prepared queries

    Mysql Done Right is a PHP5.0+ class which provides a SAFE, clean, object oriented, and efficient way to do MySQL database development.

    All queries except those with multiple row results return exactly what you need in ONE LINE OF CODE.

    This is all done while still maintaining use of prepared queries and bound parameters to eliminate the risk of SQL injection attacks and operate more efficiently.

    No extra coding is needed on your part to reuse prepared queries. You simply write the same query again, and if you have done that one before, the prepared handle is reused. The newly bound parameters are used against the existing prepared handle, and the results are recomputed. The results themselves are not cached.

    So there you have it. Simple use of prepared queries with bound parameters, while still having access to the fetch_object and fetch_assoc methods. Now you have no excuse.

    USAGE:

    See examples.php for database connection setup details.

    General format for all queries:

     $db->method_name('MySQL query with ? substituted for variables','corresponding placeholder types',corresponding variables for placeholders);

    That format explained:

    SQL queries themselves are beyond the scope of this document.  Common examples are below.

    Placeholders are allowed to be these types.  Straight from http://php.net/manual/en/mysqli-stmt.bind-param.php
      i      corresponding variable has type integer
      d     corresponding variable has type double
      s     corresponding variable has type string
      b     corresponding variable is a blob and will be sent in packets
      Sending data of type blob or text is currently limited to the size of max_allowed_packet.

    Variables to assign to each type.  Should be scalars.

    EXAMPLES:

    Inserts return insert ID:
    $insert_id = $db->pinsert('INSERT INTO sometable (somestring,someint,somedouble,someblob) VALUES (?,?,?,?)','sidb',$string,$int,$double,$blob);

    Updates return count of rows affected:
    $rows_affected = $db->pexecute('UPDATE sometable SET somestring = ? WHERE someint = ? LIMIT 1','si',$string,$int);

    Deletes return count of rows affected:
    $rows_affected = $db->pexecute('DELETE FROM sometable WHERE someint = ? LIMIT 1','i',$int);

    Just count rows return without reading the data:
    $row_returned = $db->prows('SELECT something FROM sometable WHERE somestring = ? AND someint >= ?', 'si' , $string,$int );

    Select a single row and return an object containing the data.
    $obj = $db->psingle('SELECT someint,somestring FROM sometable WHERE someint = ? LIMIT 1','i',$int);
    print $obj->someint; print $obj->somestring;

    Select multiple rows and return a handle.
    $some_sth = $db->pbind('SELECT somestring FROM sometable WHERE someint = ?','i',$int);
    while ( $row = $some_sth->fetch_object() ) { print $row->somestring; }
    $some_sth->close();



    Product's homepage

    Requirements:

    · PHP

    What's New in This Release: [ read full changelog ]

    · The license has been changed to LGPL and the documentation was updated.

      


    TAGS:

    database development | MySQL development | PHP class | MySQL | database | development

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM