Notes on the PHP programming language.
PHP Data Objects, or PDO, is a database abstraction layer specifically for PHP applications. PDO provides a consistent API for your PHP application regardless of the type of database server your application will connect to. In theory, if you are using the PDO API, you could switch the database server you used, from say Firebird to MySQL, and only need to make minor changes to your PHP code.
Its main disadvantage is that it doesn't allow you to use all of the advanced features that are available in the latest versions of MySQL server.
The mysqli extension, or as it is sometimes known, the MySQL improved extension, was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer. The mysqli extension is included with PHP versions 5 and later.
Make a Form Post to Itself with PHP
Use $_SERVER["PHP_SELF"] (in conjunction with htmlspecialchars to avoid possible exploits). i.e.
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
The count function will count the number of items in an array. Example script:
$animals = array("Lion", "Tiger", "Wolf");
$arrLength = count($animals);
// 3 will be given
// loop through the array, this will loop up to 2, giving the 0, 1 and 2 elements of the array, i.e. all of them
PHP explode() Function
// Example 1
View Server Info
// Show all information, defaults to INFO_ALL
The purpose of PHP functions is for you to stop having to write the same code again and again. Instead, you put it in a function and call the function each time.
All Content ©2020 WebRef.eu