aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--php/lib/db.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/php/lib/db.php b/php/lib/db.php
index 34e49e3..ae20f9e 100644
--- a/php/lib/db.php
+++ b/php/lib/db.php
@@ -43,7 +43,7 @@ public static function query($qry=null, $parameters=[])
else return false;
}
if(!empty($parameters)) {
- static::$result = static::$dbh->prepare($query);
+ static::$result = static::$dbh->prepare($qry);
static::$result->execute($parameters);
}
else {
@@ -149,7 +149,7 @@ public static function close($dbh=null)
* @param int $type result type
*/
public static function get_one($query,$type=PDO::FETCH_ASSOC,$parameters=[]) {
- $buf = static::get($query.' LIMIT 1',$type,$parameters);
+ $buf = static::get($query.' LIMIT 1',$type,null,$parameters);
return $buf[0];
}
@@ -162,7 +162,7 @@ public static function get_one($query,$type=PDO::FETCH_ASSOC,$parameters=[]) {
*/
public static function name_to_id($table,$id_col,$name_col,$name)
{
- $buf = static::get_one("SELECT {$id_col} FROM {$table} WHERE {$name_col} = :name", PDO::FETCH_NUM, [':name' => $name]);
+ $buf = static::get_one("SELECT {$id_col} FROM {$table} WHERE {$name_col} = ?", PDO::FETCH_NUM, [$name]);
return $buf[0];
}