24.4.4 Operation
There are a number of operations supported by PHP as follows:
■ Arithmetic operation
■ Assignment operation
■ Comparison operation
■ Incremental/ Decremental operation
■ Logical operation
■ String operation
■ Array operation
24.4.4 Operation
There are a number of operations supported by PHP as follows:
■ Arithmetic operation
■ Assignment operation
■ Comparison operation
■ Incremental/ Decremental operation
■ Logical operation
■ String operation
■ Array operation
24.4.3 Summary of PHP Syntax
If there is a static HTML tag on a web page, that page will always show the same content. However, if you use PHP to change the content of these HTML pages, the page will show the new changed contents. Like this, PHP plays a role to change the contents of a static HTML page into dynamic page. Therefore, according to the situation requested within the static HTML, a new HMTL is created and integrated with the existing static HTML tag to become an HTML document constituting a complete page.
24.4.2 Installing PHP and Connection Tool to MySQL
When installing PHP on Raspberry Pi, use the following command:
sudo apt-get install php5
If PHP is installed, the configurations of existing Apache are automatically adjusted so that PHP can integrate with Apache.
24.4.12 Simple PHP Web Page
We will here perform operations to query, input, modify, and delete data in MySQL by using PHP.
24.4.12.1 Preparing Main Document
Create the document as follows and save it in “index.php” file.
24.4.11 PHP and MySQL database
24.4.11.1 PHP MySQL extension
The functions for processing MySQL data in PHP are developed and provided as extensions of PHP. The following extensions have been developed so far.
■ Original MySQL extension
This is an extension function that was originally developed to access MySQL data in PHP. It was originally developed with the assumption that it will be applied only to systems prior to MySQL version 4.1.3. It can be applied to later versions, but it can not fully utilize the functions of the latest MySQL server, and it will be discarded in the future.
24.4.10 Transmission Methods of PHP and Key Global Variable
24.4.10.1 POST/GET Method of HTTP and PHP Processing
GET method and POST method can be used when a web browser calls the web server and send the necessary data.
● GET method
24.4 PHP Web Script Language
24.4.1 HTML and PHP
24.4.1.1 Needs for PHP
On the Internet, all web servers use HTML to receive a request from web browser which is client, and then deliver the necessary data accordingly to the web browser to express it as a general form that human can understand. HTML (Hyper-Text Markup Language) allows a web server to communicate with a web browser and send/receive data each other, and return the processing results back to people.
24.3.4 Simple HTML Web Page
24.3.4.1 Using Link to Other URL
Next is an example of linking a URL of another homepage to a specific sentence, and if clicking the sentence, the screen is switched to the specified URL.
24.3.3 Summary of HTML Syntax
24.3.3.1 HTML Overview
HTML (Hyper-Text Markup Language) is a basic language to define Internet web page. A web page consists of HTML document in the form of a tag, is transmitted via Internet, and expressed through a web browser. HTML is used to display a desired picture and text and to define function to perform a specified operation on a specific item when a web page is displayed to a user through a web browser.
24.3.2 Installing
24.3.2.1 Installing
When installing on Raspberry Pi, use the following command:
sudo apt-get install apache2