Database Operations for SQLite and PdO MySQL

Source: Internet
Author: User

Today we are studying SQLite and PdO MySQL.

Let's talk about two things in our own words:

 

SQLite is an unsystematic database storage method, and its storage format is one. DB suffix files are stored in the current directory in PHP. It seems that the user name and password are not used, and the security is low, but it is more convenient. Some built-in system functions in PhP5 start with SQLite.

The full name of PDO is PHP Data Object. Is it a system object of PHP? The operation starts with a class. Similar to MySQL.

 

 

Here is an excerpt from the function:

1. SQLite:

 

$ Db = sqlite_open ("php100.db"); <br/> $ SQL = "select * from test"; <br/> $ result = sqlite_query ($ db, $ SQL ); <br/> $ ROW = sqlite_fetch_array ($ result); <br/> print_r ($ row );

 

2. pdo mysql:

$ Db = new PDO ("MYSQL: host = localhost; dbname = student", 'root ',''); <br/> $ rs = $ db-> query ("select * From testmem"); <br/> while ($ ROW = $ RS-> fetch ()) {<br/> print_r ($ row); <br/> echo "<HR size = 1>"; <br/>}

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.