PHP tutorial: Detailed explanation of program scripts and database functions (1)_PHP tutorial

WBOY
Release: 2016-07-21 14:56:43
Original
853 people have browsed it

The Agni Website Building Academy has compiled some articles for programming enthusiasts and will slowly provide them to you in future articles. I hope it will be of some help to you. Welcome to contribute! This article mainly talks about the details of PHP scripts and databases. It is divided into three articles. Today I will talk about the first article:
In the current situation of rapid development of the Internet and endless e-commerce websites, the importance of website development Efficiency and quality put forward increasingly higher requirements.
For large-scale websites with complex structures and extensive content, it is necessary to achieve dynamic and convenient management of the website. Data management is inseparable from the support of database systems. An important indicator of measuring a CGI language is its ability to access the backend database, efficiency, etc.
And the new features of the currently popular PHP scripting language bring us a new feeling. It supports design and development in an object-oriented manner. At the same time, in order to meet the unique needs of web pages, templates, XML support, etc. have been used to bring new methods of website development. In terms of language structure, PHP has a structure similar to the C++ language, and introduces the concept of classes to simplify development.
PHP also has powerful database support capabilities. Here we will use examples to first introduce the general process of PHP accessing the database, and then introduce an advanced application of PHP accessing the database through database storage of files. Finally, through the use examples of the database class, a truly practical and efficient database development method is introduced.

Introduction to PHP database functions
PHP provides support for more than 10 common databases, such as Oracle, dBase, Informix, SQL Server, Sysbase, MySQL, etc. It is precisely because of the extensive database support that the application scope of PHP has been expanded, allowing various applications to be developed using PHP.
Among various databases, MySQL has been widely used because of its free, cross-platform, easy to use, and high access efficiency. Many central websites use the best combination of PHP+MySQL.
Oracle is a typical large-scale database application system. If the website you design has a large amount of data and high performance and efficiency requirements, Oracle is a good choice.
On the Win32 platform, SQL Server occupies a larger market. PHP can access SQL Server.
PHP encapsulates the access methods of various databases, and the functions for different database systems are also very similar, increasing the convenience of use.
Below, we will take a simple talent information exchange center (see Figure 1) as an example to program to implement online submission and browsing functions of personal resumes, and describe the entire process of PHP database operation. The database uses the most commonly used MySQL database.
Basic steps for PHP database operation
We will create a database named ResumeDB on the local machine. There is a table named Resume in the database. The table stores resume numbers, personnel names, personal profiles, and resume files in Word format.
 1. Creation of database
 Switch to the /usr/local/mysql/bin directory, and on the command line, execute the following statement to create the database:
 ./mysqladmin-u root-p create ResumeDB
 Enter password:
Enter the password after the prompt. If this is the first time the database is used, the default password is blank, just press Enter.
Then create a table to save your resume.
Create a text file Resume.sql with the following content:
use ResumeDB;
CREATE TABLE Resume (
ID tinyint(4) NOT NULL auto_increment,
Name varchar( 10) NOT NULL,
Intro varchar(255),
ResuFile longblob,
PRIMARY KEY (ID),
KEY ID (ID)
);
Put it in My In the executable directory /usr/local/mysql/bin, execute the following command:
./mysql-u root-p〈 Resume.sql
Enter password:
After entering the database password, the table Resume will automatically Created successfully. Among them, the ResuFile field is of longbolb type and is used to store binary Word documents.

  • Total 2 pages:
  • Previous page
  • 1
  • 2
  • Next page

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364163.htmlTechArticleThe Agni Website Building Academy has compiled some articles for programming enthusiasts and will slowly provide them to you in future articles. , I hope it will be of some help to you, welcome to contribute! This article mainly talks about...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template