Php runs normally on the computer, but it does not work properly on the linux Terminal.
Source: Internet
Author: User
Php runs normally on the computer on the linux Terminal but it does not solve the headache among my php file content: always prompt fatalerror; calltoamemberfunctionquery () onanon-objectonline16 $ DB-& gt; connection-& gt; query (& quot; createtabletest (idi php runs normally on the computer on the linux terminal, but it does not solve the problem.
My php file content:
Always prompts fatal error; call to a member function query () on a non-object online 16
$ DB-> connection-> query ("create table test (id integer primary key, name varchar (50), grade varchar (50), score varchar (50 ))"); this line of error always prompts me to paste it here
It is completely normal for me to run on the computer. I can insert data. when I run the data on a linux Terminal, I keep prompting that the error is going crazy. Is it a problem with terminal settings?
// Obtain the data submitted on the uiceshi.html page
$ Fname = $ _ POST ['fname']; // name
$ Fgrade = $ _ POST ['fgrade ']; // grade
$ Fscore = $ _ POST ['fscore']; // score
// $ SQL = 'Insert into test values ();';
// Create a database instance
$ DB = new SQLite ('Blog. db'); // the database file name is arbitrary.
// Create a table named test
$ DB-> connection-> query ("create table test (id integer primary key, name varchar (50), grade varchar (50), score varchar (50 ))"); this line of error is prompted
// Execute the insert statement
// $ Result = $ DB-> query ("insert into test (name, grade, score) values ('". $ fname. "','". $ fgrade. "','". $ fscore. "')");
$ Result = $ DB-> connection-> query ("insert into test (name, grade, score) values ('". $ fname. "','". $ fgrade. "','". $ fscore. "')");
// The returned results are mainly used for debugging.
Print_r ($ result );
------ Solution --------------------
SQLITE in LINUX is not installed.
------ Solution --------------------
Does the directory where SQLITE data files are stored have the write permission?
Discussion
But it can be read out. if you put data. db in the linux underground, the terminal can read but cannot insert data.
------ Solution --------------------
Grant 7777 permissions
------ Solution --------------------
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.