I am trying to use Sqlite3 to develop a web application. However, every time I keep on getting a cannot find table error when I am using the prepared statement. Please assist as best as you can with any further troubleshooting steps or courses of action that may be useful.
Here is the specific error: SQLite3::prepare(): Unable to prepare statement: 1, no such table: test in C:\Program Files\Ampps\www\onhand\classes.php on line 23
Environment:
Ampps
Geany for coding
php7.4(including making the sqlite connections)
Apache
Sqlite3 (downloaded off sqlite website and used to create the database)
Sqlite Studio (used to create the tables)
Code:
$db=new SQLite3("C:\Program Files\Ampps\www\onhand\inventory.db");
$stmt=$db->prepare('select * from test);
$result=$stmt->execute();
var_dump($result->fetchArray());
Troubleshooting steps tried:
Renamed the table- Same result of no connection
Deleted the table and recreated it- Same result of no connection
Made a copy of the database and placed in php folder- Same result of no connection
Declared absolute path of database instead of relative path-Same result of no connection
Tried to use PDO instead of native sqlite3 for php- Same result of no connection
Verified that all letters are lower case and that the spelling matches
I tried as the whoever associated with the path post to use the slashes as a / and a double slash as well. Those failed as well.