PHP Configuration SQLite Database Development Example _php tutorial

Source: Internet
Author: User
Tags sqlite database

PHP Configuration SQLite Database Development Example


Baidu Search Download Sqlitemanager tool

PHP5 already bound SQLite
1. Manually added PHP PDO driver extension support, added 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 guarantee has 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. Link SQLite in PHP

Connecting to a database

The following PHP code shows how to connect to an existing database. If the database does not exist, it will be created (by default in the application directory, for example, in the PHP application directory), and then a database object will be 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 to create our database test.dbin the current directory. You can change the path as needed. If the database was created successfully, the message shown below is displayed:

Open Database successfully

http://www.bkjia.com/PHPjc/973375.html www.bkjia.com true http://www.bkjia.com/PHPjc/973375.html techarticle PHP Configuration SQLite Database Development example Baidu search download Sqlitemanager tool PHP5 has been bound to SQLite 1, manually added PHP PDO driver extension support, in php.ini add Extension=ph ...

  • 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.