Use PDO in php to create a sqlite3 database

Source: Internet
Author: User
Error 1: 1 Uncaughtexception & amp; #39; PDOException & amp; #39; withmessage & amp; #39; couldnotfinddriver1. open the php. ini file 1extensionphp_pdo.dll and remove 1extensionphp_pdo_sqlite

Error 1:
1 Uncaught exception 'pdoexception' with message' could not find driver
1. open the php. ini file.
1 extension = php_pdo.dll
Remove
1 extension = php_pdo_sqlite.dll
2. restart the apache service.
3. write test code

01 02 echo "creating a databse \ n ";
03 try {
04 $ dbh = new PDO ('sqlite: voting. db ');
05 $ dbh-> setAttribute (PDO: ATTR_ERRMODE, PDO: ERRMODE_EXCEPTION );
06 $ dbh-> exec ('
07 create table tally (
08 QID varchar (32) not null,
09 AID integer not null,
10 votes integer not null,
11 primary key (QID, AID)
12 )');
13 www.2cto.com
14
15} catch (Exception $ e ){
16 echo "error !! : $ E ";
17 exit;
18
19}
20 echo "db created successfully! ";
21?>
4. successful!


Author: jeffsui

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.