I have this code for displaying records from sqlite.
class MyDB extends SQLite3
{
function __construct()
{
$this->open('database.sqlite');
}
}
$db = new MyDB();
if(!$db){
echo $db->lastErrorMsg();
} else {
echo "Opened database successfully\n";
}
$sql =<<<EOF
SELECT * from database_table_column;
EOF;
$ret = $db->query($sql);
while($row = $ret->fetchArray(SQLITE3_ASSOC) ){
echo "database id = ". $row['id'] . "\n";
echo "database name = ". $row['database_name'] ."\n";
echo "column name = ". $row['column_name'] ."\n";
}
echo "Operation done successfully\n";
$db->close();
and I got this following error (refer below) 1. Warning: SQLite3::query(): Unable to prepare statement: 1, no such table: database_table_column 2. Fatal error: Call to a member function fetchArray() on a non-object
I'm sure I have database.sqlite file and created a database_table_column table with id column, database_name column and column_name column but why doesnt work? any ideas, suggestions, recommendations and help would be greatly appreciated. Thank you.
Aucun commentaire:
Enregistrer un commentaire