Get amount of hours between 2 hours

If you would like to get the amount of hours between 10:00 and 12:00 then use this! [code lang=”php”] function timeDiff($firstTime,$lastTime) { $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); $timeDiff=$lastTime-$firstTime; return $timeDiff; } echo (timeDiff(“10:00″,”12:00”)/60)/60; [/code]

By Andrew Odendaal, ago

How to backup all mysql databases

In order to backup all mysql databases, you can run the following command in your linux command line: The example below is configured with username “theuser” and password “thepass”. [code lang=”bash”] mysqldump -utheuser -pthepass –all-databases > all_dbs.sql [/code]

By Andrew Odendaal, ago

Invalid command 'RewriteEngine'

If you receive the following error message if means that mod_rewrite is not enabled in Apache: Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration. [code lang=”bash”] a2enmod rewrite [/code] Bear in mind this is done like this on Linux Ubuntu, not entirely Read more…

By Andrew Odendaal, ago

PHP – hours difference (HH:MM format)

It’s very simple to get the difference in hours using PHP [code] function timeDiff($firstTime,$lastTime) { $firstTime=strtotime($firstTime); $lastTime=strtotime($lastTime); $timeDiff=$lastTime-$firstTime; return $timeDiff; } echo (timeDiff(“10:00″,”12:00”)/60)/60; [/code]

By Andrew Odendaal, ago