How many ways are there to output HTML using PHP

The con, the cat and t’e nation! Have you heard of concatenation? No? Stay with me if you haven’t! According to wikipedia: String concatenation is the operation of joining character strings end-to-end. For example, the concatenation of “snow” and “ball” is “snowball”. Concatenation is an import concept in PHP for outputting HTML. Also used in […]

Essential tech and tools for a new eCommerce site

Assuming you’ve already chosen your eCommerce platform. Below is a list of essentials that you should consider for your new e-commerce store. If you haven’t chosen a platform already. Some of the main contenders are Shopify, WooCommerce with WordPress, Magento. If you are selling digital products you could use Gumroad or GoSpaces. If you are […]

How to access PHP session variables from another PHP page

​​ One of my subscribers sent me an email asking me about problems he was having with sessions. He had already created a session variable in one PHP file. Now he had a second PHP and wanted to access the session variable in it. However he was struggling to access his session variable. He found […]

How to use PDO to UPDATE data in MySQL using PHP

You need to get data safely updated 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 […]

How to use PDO to DELETE data from MySQL using PHP

You need to delete data safely from a web page and your 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 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”; […]