Generating a random number in PHP is very simple and like most things, can be done a number of different ways. The old standby is to use the function rand() to to generate a random integer between the minimum and…
Running social networks have proven eye opening in regard to how users interact with a website. One thing that I’ve noticed that I didn’t necessarily expect is that quite a few people click the logout button. Perhaps it’s because they…
With PHP Data Objects, transactions are pretty simple. To be able to use a transaction, you simply wrap your queries with a call to beginTransaction() and either use commit() or rollBack() at the end. Rolling back is at your discretion…
Now that we know how to create a connection to our database using PHP Data Objects, let’s talk a bit about prepared statements. Now I’d like to think that we’ve all made this mistake before, taken user input and used…
PHP Data Objects (PDO) provide a consistent interface to different databases including MySQL, PostgreSQL, SQLite, SQL Server and a handful of other systems as well. Aside from database-specific SQL, the only other thing that isn’t consistent is how to connect…
This has been turning into an every 3 month thing since I originally blogged about Linode vs. DigitalOcean back in late February and then again about Linode NextGen vs. DigitalOcean in May. Not to mention when I moved out of…
Every once in a blue moon you find yourself needing to take a string and converting it to an array of characters in the string. Maybe it’s because you want to count how often certain letters exist in the string…
In a previous post we discussed how to tell whether or not you are on the command-line from within your PHP script. Today we’re going to talk about passing command-line arguments to your script. When on the command-line two variables…
So who remembers back in the day when one of the coolest things you could have on your website’s footer was the page load time? As passé as that may seem in this day in age, it’s still something that…
Score another one for HitTail as this particular topic was their suggestion. MySQL (PostgreSQL, SQL Server, SQLite or any other RDBMS I didn’t list) and Redis are completely different beasts in regard to syntax and especially schema design (or lack…