Reputation: 55
When I run the following query, SQLite tells me that there is no such column "test", where "test" is the value in the variable $entryname. I want to store $entryname into the name column, not 'name' into $entryname. Does anyone know how to do this?
$query = 'INSERT INTO files (name, description, filename) VALUES (' . $entryname . ', ' . $entrydescription . ', ' . $filename . ')';
Upvotes: 1
Views: 3323
Reputation: 73031
You need to quote your string values. They are getting interpreted as a SQLite variable otherwise.
Try the following:
$query = "INSERT INTO files (name, description, filename) VALUES ('" . $entryname . "', '" . $entrydescription . "', '" . $filename . "')";
You should also look into preventing SQL Injection.
Upvotes: 3