I have a sqlite database which i would like to query. However, there is a Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY000] error thrown when i try to read from a PHP variable.
Following are the codes ($getdb contains the file name of the db):
$final_db = $getdb[2];
$db_test = new PDO ("sqlite:Database/$final_db");
$result_test = $db_test->query("SELECT * from dcerpcrequests limit 2;");
print_r($result_test);
thanks in advance for any help! 🙂
First, right under the $final_db declaration try with a var_dump($final_db) to see what the contents of the variable exactly are. If they look good, then your problem might be something else such as hidden control characters. Try sanitizing the variable using trim(), this way.