How to use PDO to INSERT data into MySQL using PHP

You need to get data safely from a web page to a MySQL table in your database You need to sanitize that data from user input and protect against SQL injections. The following simple example will show you how to accomplish that. These are the ingredients you will need: A MySQL database A table to […]

How to use PDO to SELECT data from MySQL using PHP example

You have a MySQL table of data in your database, you want to display it on a webpage, so it can be displayed and viewed by other people. You need to have a few things in order to accomplish this: A MySQL database A table containing data in the above database The credentials to above […]

How to check a number is valid when a form is submitted to your PHP code?

You have a form on your website and you are collecting numbers You want to make sure they are valid numbers. How do you make sure they are valid numbers? First, you can validate them client-side in the browser, before the form is submitted to your server With HTML5 you can define the input field […]

How to check an email address is valid when a form is submitted to your PHP code?

How to check an email address is valid when a form is submitted to your PHP code? You have a form on your website and you are collecting email addresses You want to make sure they are valid email addresses, so that you can make use of them Whether you are replying to a customer […]

How to call a PHP function (with parentheses)

How to call a function in PHP A reader of my blog recently emailed me, asking me to check over some PHP code Nothing works from my php file except just connecting to the database It’s simple code – I’m not doing anything fancy So here’s the PHP code supplied: function getConnection( ) { $host=”host”; […]

How to add a subscriber using MailChimps API with PHP

How to add a subscriber using MailChimps API v3.0 with PHP and CURL A quick step-by-step guide with PHP code Here was the problem, my greeting card website (PamitCards.ca) has a list of subscribers sitting in a MySQL database table. Whenever I wanted to use MailChimp to send the list of subscribers an email. I […]

7 Advantages to using a standing up desk when working as a developer

Are you spending all your work day sitting writing code? Is your back feeling stiff or causing you some pain? Maybe it’s time to consider getting one of those new hip standing desks? Here’s 7 reasons that might help convince you a standing desk is worth it. You can always try one out with just […]

How do you sit and code for so damn long all day, every day?

How do you sit and code for so damn long? I feel like my wrists are going to snap off and my back/neck is deforming. Your day goes something like this, as it does for a lot of people… Wake up… SIT in your car and drive to work Or SIT maybe stand on public […]

How to INNER JOIN on the same table twice in SQL statement

Having more than one INNER JOIN to the same table can be confusing. More than one INNER JOIN can create a messy SQL statement. If you don’t use aliases they can become difficult to read. So join them with aliases, as explained below. For example say you have the following two tables: Users and Products. […]