Results 1 to 9 of 9
  1. #1

    Interesting PHP MySQL Library

    So I figured there must be some PHP developers in the crowd (admit it, no shame) and wanted to share a pretty interesting PHP MySQL library I've been working on. It's available at: http://www.meekro.com

    Basically it takes care of things like escaping parameters so I can do things like:

    Code:
    $results = DB::query("SELECT * FROM some_table WHERE id > %i AND name != %s", 15, 'Sand');
    foreach ($results as $result) {
      echo $result['name'];
    }
    Or if I only need one field, I can do something like:
    Code:
    $counter = DB::queryFirstField("SELECT COUNT(*) FROM some_table");
    echo "We have $counter rows";
    To me, that's soooooo much easier than what PHP's default mysqli library forces me to go through, and I don't need to escape stuff all the time. I've heard feedback from users that it's made their scripts much shorter and more readable, so I just thought I'd engage in some shameless self-promotion and see if anyone else might benefit from it.

  2. #2
    Join Date
    Nov 2003
    Location
    Amidst several dimensions
    Posts
    4,321
    mysqli_real_escape_string() ?

  3. #3
    Join Date
    Mar 2008
    Posts
    1,717
    PHP should support query binding, which would make escaping completely unnecessary. User-data should be nowhere near the query when it's being parsed, arguments should be injected later.

    Most every other OS does it this way, and I think PHP's PostgreSQL module supports it... the MySQL API supports it, but for some reason PHP still doesn't seem to include it.

  4. #4
    Join Date
    Feb 2003
    Location
    AR
    Posts
    2,381
    You can use PHP and MySQL with prepared statements already.

  5. #5
    Join Date
    Aug 2009
    Location
    Wolves/London
    Posts
    164
    MeekroDB is great. I've been using it in projects since I found out about it around a month ago. So far, it's proven itself to do exactly what it says on the tin and has taken the tedium away from working with MySQL.

  6. #6
    Join Date
    Mar 2008
    Posts
    1,717
    Quote Originally Posted by ThatScriptGuy View Post
    You can use PHP and MySQL with prepared statements already.
    Ahh, my mistake - it's in mysqli, not mysql. Shows how much I actually develop anything in PHP.

    How long has that been there out of curiousity? And why the heck do people insist on escaping things when binding arguments to prepared statements is so much more fool-proof?

  7. #7
    Join Date
    Feb 2003
    Location
    AR
    Posts
    2,381
    I believe prepared statements were made available with the first release of PHP5, way back in 2005/2006....I think.

  8. #8
    Join Date
    Mar 2008
    Posts
    1,717
    Quote Originally Posted by ThatScriptGuy View Post
    I believe prepared statements were made available with the first release of PHP5, way back in 2005/2006....I think.
    Ahh so it hasn't been there the entire time I've been whining about it, just most of it (the 12 months prior to PHP5 was when I quit writing my own PHP stuff and just used Wordpress instead).

    Thanks for setting me straight.

  9. #9
    Join Date
    May 2009
    Location
    Tennessee
    Posts
    303
    I'm liking this library. Keep up the great work.
    AudioProbe.net - Playing the best music from the 70s, 80s, 90s, 00s, and more...
    Commercial free, high quality 192kb/s, and firewall friendly port 80!
    Look for us in the iTunes Radio directory under Adult Contemporary

Similar Threads

  1. how to update mysql library version
    By onel0ve in forum VPS Hosting
    Replies: 4
    Last Post: 03-14-2011, 07:29 AM
  2. Interesting problem in php/mysql
    By rej1587 in forum Programming Discussion
    Replies: 2
    Last Post: 07-04-2010, 10:16 AM
  3. PHP/MySQL developer looking for interesting project
    By OxnardMontalvo in forum Employment / Job Offers
    Replies: 0
    Last Post: 11-20-2004, 10:56 AM
  4. gd library php
    By Salvatore in forum Dedicated Server
    Replies: 6
    Last Post: 05-22-2004, 01:06 PM
  5. PHP GD library
    By jasonkw in forum Hosting Software and Control Panels
    Replies: 2
    Last Post: 12-23-2002, 04:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •