Posts Tagged with 'PHP'
What are cookies in PHP?
PHP | What are cookies in PHP? A cookie is a small piece of information store by the browser on the client location and sent to the server with every request. It stores a limited amount …
What is the maximum size of a file that can be uploaded using PHP and how can we change this?
PHP | The maximum size of a file that can be uploaded using PHP The default maximum size of a file that can be uploaded using PHP is 2MB. upload_max_filesize = 2M; and we can …
How can we increase the execution time of a PHP script?
PHP | max_execution_time directive in php.ini file By changing the value of max_execution_time in the php.ini file max_execution_time = 30; // in second By default, the maximum execution time for PHP scripts is set to …
How can we know the number of days between two given dates using PHP?
Bellow code is used for the same $date1 = date(‘Y-m-d’); $date2 = ‘2006-08-15’; $days = (strtotime($date1) – strtotime($date2)) / (60 * 60 * 24); echo $days;
How can we find the number of rows in a result set using PHP?
PHP | Find the number of rows in a result set Bellow code is use for the same $sql = "SELECT * FROM table1"; $result = mysql_query($sql, $db_link); $num_rows = mysql_num_rows($result); echo $num_rows;
What are the predefined classes in PHP?
Predefined classes in PHP are: Directory stdClass __PHP_Incomplete_Class exception php_user_filter
How can we find or count number of elements in an array?
PHP | Count number of elements in an array There are two ways to find the number of elements in an array: 1. sizeof($arr), This function is an alias of count() echo sizeof($arr); 2. count($arr) echo …
What are the difference between mysqli_fetch_assoc and mysqli_fetch_array?
PHP-MYSQL | mysqli_fetch_assoc() VS mysqli_fetch_array() mysqli_fetch_assoc() function fetch a result row as an associative array where as mysqli_fetch_array() function fetch a result row as an associative array, a numeric array, or both. mysqli_fetch_assoc() The mysqli_fetch_assoc() …
What are the difference between mysqli_fetch_object and mysqli_fetch_array?
PHP-MYSQL | mysqli_fetch_object () VS mysqli_fetch_array() mysqli_fetch_object() fetch a result row as an object where as mysqli_fetch_array() fetch a result row as an associative array, a numeric array, or both. mysqli_fetch_object() The mysqli_fetch_object() function returns …
how many ways we can retrieve the data in the result set of MySQL using PHP?
PHP-MYSQL | Fetch Recoards From MySql table There are 4 ways: mysqli_fetch_row() - Get a result row as an enumerated array mysqli_fetch_array() - Fetch a result row as an associative array, a numeric array, or both mysqli_fetch_object() …
Give an example of Transaction with commit and rollback?
PHP-MySQL | Transaction with commit and rollback try { // First of all, let's begin a transaction $db->beginTransaction(); // A set of queries; if one fails, an exception should be thrown which we are handling at …
How can we get the current session id in PHP?
session_id() function There is a function session_id() in php which is use to get and/or set the current session id. string session_id ([ string $id ] ) for getting session id in php we have to …
What are default session time in PHP?
PHP | What are default session times in PHP? By default, session variables last until the user closes the browser or leaves the site otherwise most of the server terminates the session variable if you …
How to remove HTML tags from a string in PHP?
PHP | strip_tags() function strip_tags() function is use to remove HTML, XML, and PHP tags from string. The function provides you the ability to remove tags from strings. You can also ignore certain tags by …
Unset function in PHP
PHP | unset() function The function unset() is an inbuilt function in in php which is use to delete variable. unset($var) or void unset ( mixed $var [, mixed $... ] ) Note: we can …