Interesting PHP MySQL Library
Posted: Fri Mar 18, 2011 6:10 pm
So I recently ran across a library that's apparently not well known.. It's called MeekroDB. Basically it takes care of things like escaping parameters so I can do things like:
Or if I only need one field, I can do something like:
To me, that's soooooo much easier than what mysqli forces me to go through, and I don't need to escape stuff all the time. After switching to it, my script is a third shorter and much more readable.
Code: Select all
$results = DB::query("SELECT * FROM some_table WHERE id > %i AND name != %s", 15, 'Sand');
foreach ($results as $result) {
echo $result['name'];
}Code: Select all
$counter = DB::queryFirstField("SELECT COUNT(*) FROM some_table");
echo "We have $counter rows";