From d180173111518d7c87538dafdeac6727d6c6e47a Mon Sep 17 00:00:00 2001 From: Brian Evans Date: Mon, 29 Jan 2018 16:59:05 -0500 Subject: More database typo fixes --- php/lib/db.php | 6 +++--- 1 file 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]; } -- cgit v1.2.3-65-gdbad