PHP Configuration SQLite Database Development Example

Source: Internet
Author: User
Tags php code sqlite sqlite database

Baidu Search Download Sqlitemanager tools

PHP5 has been bound SQLite
1, manually added PHP PDO driver extension support, add in php.ini

Extension=php_pdo.dll
Extension=php_pdo_sqlite.dll
Extension=php_sqlite.dll

Extension_dir = "C:\Program files\apache group\php5\ext"

2, in C:\Program Files\apache Group\php5\ext guaranteed to have Php_sqlite.dll,php_pdo_sqlite.dll,

Php_pdo.dll Extension Library

3, restart Apache

4, download Sqlitemanager,create a database, save the name of "Db.sqlite" databases, build tables,
or Sqliteadmin.

5, in the PHP link SQLite

connecting to a database

The following PHP code shows how to connect to an existing database. If the database does not exist, it is created (default is created in the application directory, for example, in the PHP application directory), and a database object is returned.


 
  Open (' test.db ');
      }
   $db = new MyDB ();
   if (! $db) {
      echo $db->lasterrormsg ();
   } else {
      echo "opened database successfully\n";
   }
? >

Now, let's run the above program and create our database test.dbin the current directory. You can change the path as needed. If the database is created successfully, the message shown below is displayed:

Open Database successfully



Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.