The other day I came across a strange thing, or at least I thought it was a strange thing.
Whilst writing a small application that would migrate user accounts from one database to another, I encountered one user who could log in quite happily without entering a password at all. Read More >
Posted in Functions PHP
Tagged with MD5 PHP
Sometimes I need to run SQL Server Stored Procedures from PHP. Some development managers prefer to keep all the SQL queries stored inside SQL Server rather than embedded into the PHP code directly.
I can understand the philosophy but it’s certainly not something I’m used to. The argument is that if the query is stored in an SP then any member of the team can access and update or fix the query whether they have any PHP knowledge or not.
It kind of makes sense.
Fortunately PHP has some functions to handle this.
Read More >
Posted in PHP Queries SQL Server Tutorials
Tagged with PHP SQL SQL Server
PHP has a cool way to get the number of days in a given month. I bet you have all used this function and not known you could do this.
The function is the good old date function.
date();
So we have all used the date function to get today’s date and convert it to what ever format you choose.
For instance
date('dF m Y');
Would give us something like 12th June 2011.
Lets take it one step further and work out how many days there are in this month.
echo date('t',strtotime('june2011'));
This would give us 30, because that’s how days there are in June this year.
So what are we doing here. Lets break it down.

Posted in Functions PHP Tutorials
Tagged with Function PHP
If you are lucky enough to work for a large company which has offices all over the world you probably need your applications to know about and respect local timezones.
There seems little point having your application perform all kinds of cool wizardry if the target audience are all in bed because it’s 4am over there.
Thankfully PHP offers a simple way to set the local timezone. I’ll leave it up to you to decide which user is in which timezone.
Read More >
Posted in Functions PHP Tutorials
Tagged with Function PHP
I was recently tasked with obtaining the current quarter number.
For those who aren’t sure, the quarter number for January through March is Q1, April through June is Q2 and so on.
Read More >
Posted in Functions PHP
Tagged with Dates Function PHP