Dewd Posted October 3, 2008 Share Posted October 3, 2008 Hello, I have a bit of a problem with a simple message board using a SQLite database. When my script queries: SELECT * FROM posts ORDER BY id ASC It works absolutely fine. When I try to: sqlite_query($handle, "INSERT INTO posts (name, post, date) VALUES ('" . $message_name . "', '" . $message_msg . "', '" . $message_date . "')") or die("Error in query: ".sqlite_error_string(sqlite_last_error($handle))); It gives me a error saying: Warning: sqlite_query() [function.sqlite-query]: unable to open database file in *script location* on line 24 Error in query: unable to open database file. The whole condition is: if (isset($_POST['name']) && isset($_POST['msg'])) { $message_name = $_POST['name']; $message_msg = $_POST['msg']; $message_date = date("d/m/y"); sqlite_query($handle, "INSERT INTO posts (name, post, date) VALUES ('" . $message_name . "', '" . $message_msg . "', '" . $message_date . "')") or die("Error in query: ".sqlite_error_string(sqlite_last_error($handle))); echo '<b>Your post was successful!</b><br/>' ; } Is there something wrong? Am I using the strings wrongly? Is there a error in the query? Thanks for any help. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 4, 2008 Share Posted October 4, 2008 Since the query is generating an error about opening the file, best guess is that there is no valid/error-free sqlite_open() statement prior to the query. It would really take seeing all the relevant code for anyone one to be able to see what might be causing the problem or to be able to duplicate it on their own system. Quote Link to comment Share on other sites More sharing options...
chefsalat Posted December 12, 2009 Share Posted December 12, 2009 Hello Dewd, i Had the same problem on my linux-System. My databases are in the directory "sqlite". The databases had the "0777" permissions. But the directory "sqlite" himself had the "0755" permissions. A "chmod 0777 sqlite" had solved the problem. I hope, it solves your problem too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.