1 |
commit: d180173111518d7c87538dafdeac6727d6c6e47a |
2 |
Author: Brian Evans <grknight <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jan 29 21:59:05 2018 +0000 |
4 |
Commit: Brian Evans <grknight <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jan 29 21:59:05 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/bouncer.git/commit/?id=d1801731 |
7 |
|
8 |
More database typo fixes |
9 |
|
10 |
php/lib/db.php | 6 +++--- |
11 |
1 file changed, 3 insertions(+), 3 deletions(-) |
12 |
|
13 |
diff --git a/php/lib/db.php b/php/lib/db.php |
14 |
index 34e49e3..ae20f9e 100644 |
15 |
--- a/php/lib/db.php |
16 |
+++ b/php/lib/db.php |
17 |
@@ -43,7 +43,7 @@ public static function query($qry=null, $parameters=[]) |
18 |
else return false; |
19 |
} |
20 |
if(!empty($parameters)) { |
21 |
- static::$result = static::$dbh->prepare($query); |
22 |
+ static::$result = static::$dbh->prepare($qry); |
23 |
static::$result->execute($parameters); |
24 |
} |
25 |
else { |
26 |
@@ -149,7 +149,7 @@ public static function close($dbh=null) |
27 |
* @param int $type result type |
28 |
*/ |
29 |
public static function get_one($query,$type=PDO::FETCH_ASSOC,$parameters=[]) { |
30 |
- $buf = static::get($query.' LIMIT 1',$type,$parameters); |
31 |
+ $buf = static::get($query.' LIMIT 1',$type,null,$parameters); |
32 |
return $buf[0]; |
33 |
} |
34 |
|
35 |
@@ -162,7 +162,7 @@ public static function get_one($query,$type=PDO::FETCH_ASSOC,$parameters=[]) { |
36 |
*/ |
37 |
public static function name_to_id($table,$id_col,$name_col,$name) |
38 |
{ |
39 |
- $buf = static::get_one("SELECT {$id_col} FROM {$table} WHERE {$name_col} = :name", PDO::FETCH_NUM, [':name' => $name]); |
40 |
+ $buf = static::get_one("SELECT {$id_col} FROM {$table} WHERE {$name_col} = ?", PDO::FETCH_NUM, [$name]); |
41 |
return $buf[0]; |
42 |
} |