save data in a data base with a html form

Skip to first unread message


Jul 28, 2016, 3:05:17 PM7/28/16
to phpliteadmin
Hello to you!
I would want to link a database that i have created with SQLite admin to a html form but
i can not do it because, i do not know the default (user name , password and the server name) of Sqlite Admin. I do not know how to connect to my base given .
I try with :
Server : localhost .
user : root ;
password : root ;
But it does not work.

Here is how I did with my scripts but no results .
$Base = "./ MyBase " ;
$Server = "localhost" ;
$User= "root" ;
$Password = "root" ;
$linkbase= mysql_connect ( $Server , $User , $Password)
// Selection of the database
$ Return = mysql_select_db ( $Base , $linkbase)

Please I will like to know everything you need to connect my html form has my database because it is so different from PhpMyAdmim I usually use .
thank you in advance

Christopher K.

Jul 28, 2016, 4:18:36 PM7/28/16

SQLite is not a server based Database and especially, it is not MySQL. So using mysql_connect will not work. (And mysql_connect is also deprecated for MySQL! Use MySQLi or PDO for MySQL.) Depending on what PHP extensions are installed on your server, you would need to use the SQLite3 extension or PDO to use an SQLite3 Database.

In SQLite there is no server, you only need access to the database file. So there also is no username or password. You just connect and query the database like this:

Using SQLite3:
= new SQLite3('mysqlitedb.db3');

$results $db->query('SELECT bar FROM foo');
while (
$row $results->fetchArray()) {

mysqlitedb.db3 is the name of your database file (assuming it is in the same directory, if not, add the path).

Or using PDO:

$conn = new PDO("sqlite:mysqlitedb.db3");
$sql 'SELECT name, color, calories FROM fruit ORDER BY name';
foreach ($conn->query($sql) as $row) {
    print $row['name'] . "\t";
    print $row['color'] . "\t";
    print $row['calories'] . "\n";


I hope this helps you to get stared.


Ovide .

Jul 28, 2016, 8:59:47 PM7/28/16
to Christopher K.,
If I want to insert for example , a name in a table ( called "data" ) contained in a database ( called 'database' ) . In the user-name field. How do I do? Please I will like to have the complete procedure .

Christopher Kramer

Jul 29, 2016, 4:17:41 AM7/29/16
to phpliteadmin

Am Freitag, 29. Juli 2016 02:59:47 UTC+2 schrieb Ovide:
If I want to insert for example , a name in a table ( called "data" ) contained in a database ( called 'database' ) . In the user-name field. How do I do? Please I will like to have the complete procedure .
First, this mailing list is not for SQlite or PHP questions, it is for phpLiteAdmin. Your problems are not related to phpLiteAdmin, so you are asking at the wrong place. Maybe post your questions at stack overflow for example. Also, before asking someone, first please read the manuals, especially if somebody provides you links to it. And search the web first. Its not like there are no tutorials on SQLite and PHP.

One last answer:

Using SQLite3, you insert into an SQLite db like this (see the manual on exec):

= new SQLite3('database');
$results $db->exec('INSERT INTO data ("user-name") VALUES(\'bob\')');


Ovide .

Jul 29, 2016, 7:55:48 AM7/29/16
Thank you! Thank you very much.
I'm happy. Thanks

You received this message because you are subscribed to a topic in the Google Groups "phpliteadmin" group.
To unsubscribe from this topic, visit
To unsubscribe from this group and all its topics, send an email to
For more options, visit

Jan Zumwalt

Jul 29, 2016, 10:50:11 PM7/29/16
to phpliteadmin
I also wanted db access from html. So... I'll share extensive research I did on my own on this subject.
The short answer is the only way to do this is using client side JS browser  hidden info that can not be modified or backed up.
Google Chrome and Firefox experimented with the capability and other browsers immediately blocked the capability - they eventually abandon the feature.
The only reasonable way to access DB info is server side using PHP and sqlite.

I think it is a sever flaw to ignore db capability in html, but the html and JS consortium apparently see things different.
Reply all
Reply to author
0 new messages