Creative, Informative and Entertaining Stuff for everyone

Sunday September 5th 2010

Categories

Archives

Calender

September 2010
S M T W T F S
« Jul    
 1234
567891011
12131415161718
19202122232425
2627282930  

‘PHP’ Archives

export data to excel file (.xls format)

By using the below code you can export your data from the database to excel file. When you run the below code, the excel file get generated and get downloaded to the client machine.

GD support

How to check if GD support is enabled or not. <?php var_dump(gd_info()); ?> If GD support is enabled then you will get an array in that you will get "GD Version". If you didn't get this that means GD support is not there . To enable GD support you should install GD library by the below command "yum install php-gd" (Fedora [...]

Calculate no of years,month,days,hours,minutes and seconds past since given date

public function getYMDHMSPastFromTime($timestamp) { $years = ''; $Month = ''; $Days = ''; $Hrs = ''; $Mins = ''; $totalSecs = ''; $timePastArr = array(); $date1 = time(); $date2 = $timestamp; $dateDiff = $date1 - $date2; $totalYears = $dateDiff/(365*24*60*60); $years = floor($totalYears); $timeRemaining = ($dateDiff - [...]