There aren't many new releases these days because the project has reached a "stable" state and there are no known bugs. However, if I find out about any, I'm happy to fix and put out a new release. You can report bugs on GitHub.
MeekroDB has been Google's #1 search result for "php mysql library" since 2012 and has thousands of deployments worldwide. In that time, we have never had any security issues. The code is developed with a healthy level of paranoia, and automated unit tests check every new version for problems. Our code is open source, and many developers have examined it for security flaws and found none. While there is no such thing as a 100 percent guarantee, an excellent security track record like ours is a good place to start.
Absolutely! The easiest thing to do is just switch between databases with DB::useDB()
. If you actually want multiple connections, you should use new MeekroDB() to create non-static instances of MeekroDB.
You need the line mysqli.reconnect = 1
in your php.ini file. This file might be in a different place depending on your server, but Ubuntu has /etc/php5/cli/php.ini
and /etc/php5/apache2/php.ini
. Because of PHP restrictions, there is no way to change this setting without having root and MeekroDB can't set it for you. See PHP documentation on this for more.
You should use DB::queryRaw()
to get a mysqli_result object, and then use PHP's mysqli_result->fetch_assoc
to grab rows one at a time.
By default, DB::insert()
uses NULL if you pass a variable that's unset or set to null. You can change this by setting DB::$usenull
to false.
DB::insert()
does not return anything. If an INSERT operation fails, MySQL treats this as an error (same as if you gave an invalid MySQL query). By default, this means MeekroDB's error handler will run, but you can change that behavior with the variables $error_handler
and $throw_exception_on_error
.
On the other hand, a DB::insertIgnore()
will not trigger an error if the INSERT fails. In this case, you can check if it worked by checking the DB::affectedRows()
count.
The character that MeekroDB's placeholders start with defaults to %, but can be changed with DB::$param_char
.
DB::$param_char = ':';
DB::query("SELECT * FROM accounts WHERE email=:s", 'user@host.com');
DB::queryFirstField("SELECT DATE_FORMAT('2009-10-04 22:23:00', '%H:%i:%s')");