Adding these two little lines at the top of your code can often solve a world of questions you have on why your code isn’t working. Make sure they are placed at the very top right after the opening <?php tag. If anything is output before them it will not work properly. Another helpful tool […]
Create MySQL Database and Add New User (command line)
Here is a quick example of how to create a database, assign a new user and set their password. Connect to MySQL server as user “root” (you will be prompted for a password) The “mysql>” prompt will now appear. Create new database… we’ll call it “orders” Give user (named “fluffy”) full permissions Set password for […]
Get file extension from a string in PHP
Sometimes you just need to get the file extension from a string. Here are a couple quick solutions to get it in literally 1 line of code. Option #1 Option #2
Tip for Validating Cookies
When displaying and using cookies it is important to validate them especially when they are integral to the functionality of the page. Make sure to check to see if the cookie is set before displaying it.