|
PHP
Introduction PHP (Personal Home Page): Hypertext Preprocessor, a free and cross-platform scripting language, supports many of the most popular database servers on the market, including MySQL, Oracle, Sybase, mSQL, Generic ODBC, and PostgreSQL, etc. It is the most popular choice among the open-source society for MySQL database server on Linux platform. Much of PHP is a combination of Perl, Java, and C concepts. The syntax structure which borrows heavily from C makes it easy to learn for beginners. PHP codes are embedded directly in HTML pages, easy to modify and debug. In HTML pages, PHP codes are marked by <?php and ?> tags or <? and ?> tags.
PHP and Web Server PHP is known as a server-side scripting language. To support PHP, a module (language interpreter) for Web server should be downloaded and installed. Once correctly configured, a Web server can recognize Web pages with extension ".php" or ".php3" (as specified in configuration), and execute PHP commands. When a PHP page is requested by a Web browser or when a form is submitted and a PHP page is evoked to process the data, the embedded PHP commands on that page are interpreted and executed by the PHP-enabled Web server. After the interaction between PHP and MySQL, data retrieved from MySQL are sent with HTML tags to the Web browser by the server. PHP and Database Server For PHP to talk to a database server, you need to set up the connection first. Within the PHP tag, use syntax:
To open a database in MySQL:
To do queries:
To close the connection to database:
The PHP codes then are executed to open a database, do the queries, and close the connection. Example In this example, we will demonstrate how to execute a simple SQL query, using the MySQL database on Ruby. Links Tutorials For Beginners (a collection of links) PHP Online Manual @ PHP official site
|
||
|
Created by Jian-Qing
Wu
Last modified: |
||