PHP NotesNotes on the PHP programming language. PDOPHP 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. https://www.php.net/manual/en/mysqli.overview.php 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. mysqliThe 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. https://www.php.net/manual/en/mysqli.overview.php
Make a Form Post to Itself with PHPUse $_SERVER["PHP_SELF"] (in conjunction with htmlspecialchars to avoid possible exploits). i.e. <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post"> See: https://stackoverflow.com/questions/5826784/how-do-i-make-a-php-form-that-submits-to-self Count ArrayThe count function will count the number of items in an array. Example script: <?php $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 ?> View output of animals-array.php script PHP explode() Functionhttps://www.php.net/manual/en/function.explode.php Example: // Example 1 View Server Info<?php // Show all information, defaults to INFO_ALL ?> PHP FunctionThe 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. Visit LowPrices.co.uk for Your UK Shopping
|
|
All Content ©2020 WebRef.eu |