Reputation: 891
I'm gettng a weird error from PDO and it doesn't make sense. I am trying the following code but even if I change the code I get the exact same error that doesn't reflect any of the changes.
$stmt = $db->prepare("SELECT database, gpsthr from ccprefs where fleetnumber=?");
$stmt->bindValue(1, (int) $smpfleet, PDO::PARAM_INT);
$stmt->execute();
Here's the error message:
"SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' gpsthr from ccprefs where fleetnumber= ?' at line 1"
If I change the code to this I still get the same error.
$stmt = $db->prepare("SELECT database, gpsthr from ccprefs where fleetnumber= :fleet");
$stmt->bindValue(':fleet', (int) $smpfleet, PDO::PARAM_INT);
$stmt->execute();
Upvotes: 2
Views: 50