Thursday, June 20, 2013

Tips for speeding up your PHP scripts

A PHP one-liner to keep the date/time the page was last updated:
page last updated <?php echo date(“F d Y H:i:s”, getlastmod() ); ?>
Note: uses the server timezone by default. getlastmod() returns a timestamp and if you are on a shared server (virtual hosting) and cannot change the timezone, let’s say the timezone is off by […]

How to use MySQL REPLACE function

Here’s a MySQL query fuction that’s easy to forget about: REPLACE. Let’s say I have a bunch of records in a field with http://www and want to quickly change all to http://. Here’s the syntax to update:
UPDATE tdurl_1 SET URL = REPLACE(URL, ‘http://www.tdurl.com/’,’http://tdurl.com/’);

How to build a how many days in the future script with timezone offset

This morning I was wondering what the date would be an arbitrary number of days in the future, like if somebody says: get back to me in a few months. I decided to search Google to see if there was a simple, web-based form that I could enter in the number of days in the […]

Ad Inside Post

Comments system

Disqus Shortname