How-To: Create a mysql friendly date with php
This is really simple - and quite useful if you are trying to insert a date into mysql and you can’t use the “now()” mysql command (due to say a timezone difference):
$date = date(”Y-m-d G:i:s”);
This is really simple - and quite useful if you are trying to insert a date into mysql and you can’t use the “now()” mysql command (due to say a timezone difference):
$date = date(”Y-m-d G:i:s”);
A common requirement when performing maintenance on your website is to redirect all requests to a downtime message. This can be very easily achieve using mod_rewrite and a .htaccess file. Simply create an .htaccess file with the following commands:
RewriteEngine On
RewriteRule !^site-down\.html$ /site-down.html [L]
This will redirect all requests to the site-down.html file. Once [...]
We had a YouTube video of our product embedded on our website, however it was pretty low-resolution. I wanted to make it display in higher quality, however still making use of YouTube’s servers.
After a little sniffing around, I discovered that you simply add a little bit extra to the embed parameters and it embeds [...]
We use CVSDude.org to host all our subversion repositories. They have recently upgraded to subversion 1.5.0 which is not compatible with 1.4.x clients. Unfortunately the command line utility that is built into Mac OS X is only at version 1.4.4 on my MacBook Pro - so I needed a way to upgrade to version 1.5.
I’ve [...]
Need to remove the trailing whitespace characters from a string in php? chomp() is how you do it in Perl, however in PHP it’s just as easy. Simply use rtrim():
// $string = “|my string with trailing whitespace |”
$string = rtrim($string);
// $string = “|my string with trailing whitespace|”
It’s that easy! There is [...]
More and more mail servers are starting to reject email if your outgoing mail server doesn’t have a reverse DNS record or PTR record. You can check if you have one by issuing the following command:
dig -x 127.0.0.1
Obviously, replace the 127.0.0.1 address with the relevant IP address of your mail server. You should [...]
We use prototype.js and scriptaculous for a number of our sites and applications - they provide great foundations with which to build advanced javascript applications. However they can be fairly large and take a while to download.
As I’ve previously mentioned on this blog, you can get pre-shrunk versions of both prototype and scriptaculous which [...]
A number of people have reported problems viewing some images in Firefox 3, where they get the error:
<image> cannot be displayed, because it contains errors
Amazingly enough, there is a very simple fix to this problem - disable the Skype Add-On for Firefox. This can cause this problem to occur, so disabling it often fixes the [...]
Optus has just announced iPhone plans including pre-paid and post-paid plans for those who registered on their iPhone site.
To summarise these:
$79 a month gets you an iPhone for free
Include 800MB of data per month.
Unlimited data usage in the first month applies.
Prepaid the phone costs $729 for 8GB and $849 for 16GB phone
These are pretty good, [...]