Blog Archives

you can learn here basics about Php.

Basics of Session and Cookies

We know that Webpages are getting displayed using stateless Protocol. So there should be someway for keeping the session of the user navigating the webpages within a website. Session variables and Cookie variables can be used for this purpose. Basically Session variables

Posted in Basics of Internet, Html, Php Tagged with: ,

Handling Date and Time in PHP/MySQL

Date and time can be inserted into mysql table in specific format only. But php will support different types of date and time formats. So, we should convert the date and time from php into specific format before inserting the

Posted in MySQL, Php Tagged with: ,

Steps for PHP installation

We can follow below steps for installing php with Apache server. Install Apache-2 while (installing it give domain name and server name as localhost) Create a folder inside Apache with name=”php”. Unzip the file “” inside the folder “php”. Rename the file “php.ini-recommanded”

Posted in Php Tagged with: ,

PHP mysql_insert_id

The mysql_insert_id() function returns the AUTO_INCREMENT ID generated from the previous INSERT operation. Syntax mysql_insert_id($connectionlink); You can refer this link for knowing more about this function and example.

Posted in Php

Get current Page Name in php

The basename($_SERVER[‘PHP_SELF’]) function is used to get current pagename only. basename($_SERVER[‘PHP_SELF’]); You can refer this link for more information.

Posted in Php

Getting Previous page url in php

In this post will explain how to get previous page url using php. In php it have built-in function for getting previous page url. Example: <?php $_SERVER['HTTP_REFERER']; // return the previous page url. ?>

Posted in Php

How to get last key in an array?

In this post will explain how to get last key in an array using php. A solution would be using both end() and key(). end() – point array ‘s internal pointer to the last element, and returns its value. key()

Posted in Php

PHP htmlentities () Function

htmlentities() – Convert all applicable characters to HTML entities! ENT_COMPAT – will convert double-quotes and leave single-quotes alone. ENT_QUOTES – will convert both double and single quotes. ENT_NOQUOTES – will leave both double and single quotes unconverted. You may refer

Posted in Php

PHP htmlspecialchars() Function

The htmlspecialchars() function converts some predefined characters (<, >, single quote ‘, double quote " and ampersand) to HTML entities. htmlspecialchars($string,$quotestyle) $string – Required. Specifies the string to convert $quotestyle – Optional. Specifies how to encode single and double quotes.

Posted in Php

PHP nl2br() Function

It replaces all new line characters in a string with HTML BR tags. The nl2br() function inserts HTML line breaks (<br>) in front of each newline (\n) in a string. Example: <?php echo nl2br("first line.\nsecond line."); ?> The output of

Posted in Php