I have the following query:
$sql = "UPDATE db.users SET $str WHERE users.{$this->row} = {$this->value} LIMIT 1";
Which echo’s out:
UPDATE db.users SET username=testUser, gid=3 WHERE users.username = mmiller LIMIT 1
However when I do:
$count = Db::init()->exec($sql);
I get:
Fatal error: Uncaught exception 'PDOException' with message‘SQLSTATE[42S22]: Column not found:
1054 Unknown column ‘mmiller’ in
‘where clause” in
/class.php:185
Stack trace: #0
/class.php(185):
PDO->exec(‘UPDATE db…’) #1
/class.php(194):
User->modify(‘username’, ‘gid’,
‘testUser’, ‘3’) #2 {main} thrown in
/class.php
on line 185
Any ideas?
You need to use
"Make sure your echo shows you that. You could use
'ofcourse, whatever floats your boat 🙂