Apr 5, 2011

Adding an editable grid

When you are developing web applications there are situations in which you would like to add an editable grid to the application. Here is the one that can be used for free under GPL.
http://www.webismymind.be/editablegrid/

Jan 16, 2011

How to identify the active php.ini

In the development environment sometimes when you have multiple versions of PHP installed on the same wamp setup you need to know which version of php.ini is active.

You can get the path by creating a phpinfo.php file and simply calling the function phpinfo() in it.

Access the file through your browser. It will list all the relevant information about your PHP/MySQL version. Locate the Loaded Configuration File variable and use that path to make changes in the active php.ini file.

Aug 14, 2010

Web Basics with PHP

1. How to handle cookies in PHP
setcookie(), $_COOKIE,

2. How to redirect to a different location
header()

3. How to handle sessions in PHP
session_start(), $_SESSION, session_name(), session_save_path()

4. How to detect browser
get_browser()

5. How to read configuration variables
ini_get()

May 23, 2010

PHP Date

1. How to find current date and time.
strftime(), getdate(), date()

2. How to find the difference of two dates.
You can find the difference of two dates by first converting both the dates into Unix timestamps using mktime() and then subtracting one from the other. The difference is the time in seconds elapsed.

3. How to validate a date.
checkdate()

4. How to set date timezone.
date_default_timezone_set()

5. How to generate unique ID.
microtime()

Apr 24, 2010

PHP Number Functions

Following are the few number handling functions.

1. How to check for a valid number in string.
is_numeric()

2. How to round numbers.
round(), ceil(), floor()

3. How to generate random numbers.
mt_rand(), rand(), srand(), mt_srand()

4. How to format numbers
number_format()

5. Absolute Value
abs()