Home > Backend Development > PHP Tutorial > The relationship between php and php MySQL_PHP tutorial

The relationship between php and php MySQL_PHP tutorial

WBOY
Release: 2016-07-21 15:45:42
Original
1074 people have browsed it

This tutorial is not intended to give you a complete understanding of the language, but to get you started developing dynamic web sites as quickly as possible. I assume you have some basic knowledge of HTML (or an HTML editor) and some programming ideas.
Introduction
PHP is one of the tools that allows you to generate dynamic web pages. PHP stands for: Hypertext Preprocessor (PHP: Hypertext Preprocessor). PHP is completely free, no need to spend money, you can download it freely from the PHP official site (http://www.php.net). PHP complies with the GNU Public License (GPL), under which many popular software such as Linux and Emacs were born. You have unlimited access to the source code and can even add the features you need. PHP runs on most Unix platforms, GUN/Linux and Microsoft Windows platforms. Information on how to install PHP on a PC machine or Unix machine in a Windows environment can be found on the PHP official website, or you can check out the special article "Comprehensive PHP Installation Tips" on the Tao Bar website. The installation process is simple.
If your machine solves the 2000 problem, then PHP will also not have the Y2K problem!
History
Three years ago, Rasmus Lerdorf created Personal Home Page Tools in order to create his online resume. It's a very simple language. Since then, more and more people have noticed this language and made various suggestions for its extension. Through the dedication of many people and the source-free nature of the language itself, it evolved into a feature-rich language that is still growing.
Although PHP is easy to learn, it is slower than mod_perl (the perl module embedded in the web server). There is now a new engine called Zend that is as fast as mod_perl, and PHP4 can take full advantage of this engine. Now, the official version of PHP4 has been released, and you can download it from the official website of PHP. Andy Gutmans and Zeev Suraki are Zend's primary authors. You can go to the Zend site (http://www.zend.com) to learn more.
The application of PHP has grown significantly in personal web projects. According to Netcraft's October 1999 report, there were 931,122 domains and 321,128 IP addresses utilizing PHP technology.
Advances of PHP
There are many benefits of applying PHP. Of course, the known disadvantage is that because PHP is an open source project, there is no commercial support, and the resulting slow execution speed (until PHP4). But PHP's mailing list is very useful and unless you're running a very popular site like Yahoo! or Amazon.com, you won't notice any difference in PHP's speed. At least I didn’t feel it! Okay, let's take a look at the advantages of PHP:
Learning process
I personally prefer PHP's very simple learning process. Unlike Java and Perl, you don't have to immerse yourself in 100-plus pages of documentation to write a decent program. As long as you understand some basic syntax and language features, you can start your PHP coding journey. If you encounter any trouble later during the coding process, you can read the relevant documents again.
PHP’s syntax is similar to C, Perl, ASP or JSP. For those who are more familiar with one of the above languages, PHP is too simple. On the contrary, if you know more about PHP, then it will be easy for you to learn several other languages.
You only need 30 minutes to master all the core language features of PHP. You may already know HTML very well, and you even know how to use editing and design software or manually to create a beautiful WEB site. Since PHP code can be easily added to your site, when you design and maintain your site, you can easily add PHP to make your site more dynamic.
Database Connections
PHP can be compiled with functions to connect to many databases. PHP and MySQL are an excellent combination right now. You can also write your own peripheral functions to access the database indirectly. In this way, when you change the database you use, you can easily change the coding to adapt to such changes. PHPLIB is the most commonly used series of base libraries that can provide general transaction needs.
Scalability
As mentioned before, PHP has entered a period of rapid development. It may be difficult for a non-programmer to extend additional functionality to PHP, but it is not difficult for a PHP programmer.
Object-oriented programming
PHP provides classes and objects. Web-based programming work requires object-oriented programming skills. PHP supports constructors, extracted classes, etc.
Scalability
Traditionally, the interaction of web pages is achieved through CGI. The scalability of CGI programs is not ideal because it opens a separate process for each running CGI program. The solution is to compile the interpreter of the language commonly used to write CGI programs into your web server (such as mod_perl, JSP). PHP can be installed this way, although few people are willing to install it CGI this way. Embedded PHP can be more scalable.
More features
In order to be more suitable for web programming, PHP developers have developed many peripheral popular base libraries, which contain easier-to-use layers. You can use PHP to connect to most databases including Oracle, MS-Access, and Mysql. You can draw pictures on flies, write programs to download or display e-mails.You can even complete network-related functions. Best of all, you can choose which features your PHP installation requires. To quote Nissan's Xterra, PHP can do everything you want it to do and it's omnipotent!

Introduction to MySQL
MySQL is a semi-commercial database that is widely loved by the Linux community. . MySQL runs on most Linux platforms (i386, Sparc, etc.), as well as a few non-Linux and even non-Unix platforms.
License Fee
MySQL's popularity largely stems from its permissiveness, in addition to its slightly unusual licensing fee. MySQL pricing varies by platform and installation method. The Windows version of MySQL (NT and 9X) is not free in any case, while MySQL for any Unix variant (including Linux) is free if installed by the user himself or a system administrator rather than a third party. A license fee must be paid.
Price
Platform installation method price
Windows NT, 9X any $200
Unix or Linux self-installation free
Unix or Linux third-party installation $200
Requires an application component $200
A variety of support contracts are available. There are too many to list here. For the latest quotes, please consult the MySQL website.
3. Installation
Most major software package formats (RPM, DBE, TGZ) are available on the MySQL site. Client libraries and various language "wrappers" (Wrapper) are available in separate RPM formats. Installation in RPM format is painless and requires no initial configuration. An initial script is generated in rc3.d (taking RedHat RPM as an example), so the MySQL daemon is started when restarting in multi-user mode. MySQL's daemons (mysqld) consume very little memory (on a Pentium 133 running RedHat 5.1, each daemon uses 500K of memory and another 4M of shared memory overhead) and is loaded into the process only when a real query is executed. On the server, this means that for small databases, MySQL can be used fairly easily without having too much impact on other system functions.
Data Types
It’s a good thing that fields support a lot of data types. Common integers, floating point numbers, strings, and numbers are represented in multiple lengths, and support variable-length BLOB (Binary Large OBject) types. The auto-increment option is used for integer fields, and date and time fields can also be well represented.
MySQL differs from most other database systems in providing two relatively uncommon field types: ENUM and SET. ENUM is an enumeration type, very similar to the enumeration type of Pascal language. It allows programmers to see field values ​​​​similar to 'red', 'green', 'blue', while MySQL only stores these values ​​​​as a word. Festival. SET is also borrowed from Pascal. It is also an enumeration type, but a single field can store multiple values ​​at a time. This ability to store multiple enumeration values ​​may not impress you (and may threaten the third normal form definition) ), but using the SET and CONTAINS keywords correctly can save a lot of table connections and achieve good performance improvements.
5. SQL Compatibility
MySQL contains some changes that are different from the SQL standard, most of which are designed to compensate for the shortcomings of the SQL language scripting language. However, other extensions do make MySQL unique; for example, LINK clause searches automatically ignore case. MySQL also allows user-defined SQL functions. In other words, a programmer can write a function that is then integrated into MySQL and behaves no differently than any basic function such as SUM() or AVG(). The function must be compiled into a shared library file (.so file) and then loaded with a LOAD FUNCTION command.
It also lacks some common SQL features, there are no subselects (queries within queries). The View is gone too. Of course most subqueries can be rewritten with simple join clauses, but sometimes it's easier to think in terms of two nested queries than one big join. Again, the view merely hides the where clause from the programmer, but this is another convenience that programmers expect.
Stored Procedures and Triggers
MySQL does not have a stored procedure (Stored Procedure) language, which is the biggest limitation for programmers who are accustomed to enterprise-level databases. Multi-statement SQL commands must be coordinated through client code. This is achieved with the help of a fairly robust query language and the ability to lock and unlock tables on the client side to allow multiple statements to run.
7. Referential Integrity (Referential Integrity-RI)
One of the main flaws of MySQL is the lack of a standard RI mechanism; however, the creators of MySQL are not deaf to the wishes of its users and provide some solution. One of them is support for unique indexes. The lack of rule restrictions (a fixed range limit on a given field) is compensated by the large number of data types. Not simply providing check constraints (limits on the value of one field relative to another field in the same row), foreign keywords, and the "cascading delete" functionality often associated with RI. Interestingly, the SQL parser tolerates the syntax of these statements when these features are not supported. The purpose of this is to easily transplant the database to MySQL. This is a good attempt, and it does leave the door open for future support of this feature; however, those who don't read the documentation carefully may be fooled into thinking that these features actually exist.
7. Security
My biggest complaint about MySQL from beginning to end is its security system. Its only shortcoming is that it is complicated rather than standard. In addition, it only changes when mysqladmin is called to reread user permissions. The usual SQL GRANT/REVOKE statements were not supported until recent versions, but at least they are there now. MySQL's writers have extensively documented its specific security system, but it does require a learning curve that may not otherwise be possible.

apache+php+mysql is the best combination, and it is also the best combination for corporate networks.

If you learn PHP, you can find many tutorials on the Internet. In fact, the best way to learn any program is to write, keep writing and keep reading.

Of course the best way to make a website is Dreamweaver, which can write a lot of code and can also design!

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320284.htmlTechArticleThis tutorial does not want you to fully understand this language, it just allows you to join the ranks of developing dynamic web sites as soon as possible . I assume you have some basic knowledge of HTML (or an HTML editor) and some...
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