Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e403c774c8 | ||
|
|
740ca7bc67 | ||
|
|
7563c660ad |
21
README.md
21
README.md
@@ -8,6 +8,27 @@ MeekroDB is:
|
||||
* Google's #1 search result for "php mysql library" for over 2 years, with **thousands of deployments worldwide**.
|
||||
* A library with a **perfect security track record**. No bugs relating to security or SQL injection have ever been discovered.
|
||||
|
||||
Installation
|
||||
========
|
||||
When you're ready to get started, see the [Quick Start Guide](http://www.meekro.com/quickstart.php) on our website.
|
||||
|
||||
### Manual Setup
|
||||
Include the `db.class.php` file into your project and set it up like this:
|
||||
|
||||
require_once 'db.class.php';
|
||||
DB::$user = 'my_database_user';
|
||||
DB::$password = 'my_database_password';
|
||||
DB::$dbName = 'my_database_name';
|
||||
|
||||
### Composer
|
||||
Add this to your `composer.json`
|
||||
|
||||
{
|
||||
"require": {
|
||||
"sergeytsalkov/meekrodb": "*"
|
||||
}
|
||||
}
|
||||
|
||||
Code Examples
|
||||
========
|
||||
### Grab some rows from the database and print out a field from each row.
|
||||
|
||||
@@ -539,7 +539,7 @@ class MeekroDB {
|
||||
else if ($type == 'd') $result = doubleval($arg);
|
||||
else if ($type == 'b') $result = $this->formatTableName($arg);
|
||||
else if ($type == 'l') $result = $arg;
|
||||
else if ($type == 'ss') $result = "%" . $this->escape(str_replace(array('%', '_'), array('\%', '\_'), $arg)) . "%";
|
||||
else if ($type == 'ss') $result = $this->escape("%" . str_replace(array('%', '_'), array('\%', '\_'), $arg) . "%");
|
||||
else if ($type == 't') $result = $this->escape($this->parseTS($arg));
|
||||
|
||||
else if ($type == 'ls') $result = array_map(array($this, 'escape'), $arg);
|
||||
|
||||
@@ -256,7 +256,7 @@ class BasicTest extends SimpleTest {
|
||||
$this->assert($rows[1]['password'] === 'somethingelse');
|
||||
$this->assert($rows[1]['username'] === '2ofmany');
|
||||
|
||||
$nullrow = DB::queryOneRow("SELECT * FROM accounts WHERE username=%s", '3ofmany');
|
||||
$nullrow = DB::queryOneRow("SELECT * FROM accounts WHERE username LIKE %ss", '3ofman');
|
||||
$this->assert($nullrow['password'] === NULL);
|
||||
$this->assert($nullrow['age'] === '15');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user