Displaying data from MySQL without a page reload using Ajax
Displaying data from MySQL without reloading the page can be done with an on-click event which does an Ajax request that then fills elements with the returned data. This is…
Displaying data from MySQL without reloading the page can be done with an on-click event which does an Ajax request that then fills elements with the returned data. This is…
The differences between constants and variables in PHP isn’t enormous but here they are: A constant cannot be changed once set and constants are global so unlike variables they can…
OPcache is said to improve PHP performance by storing scripts in shared memory thus avoiding the need to load scripts on each request. Whilst seemingly basic, its setup and enabling…
The basics for PHP MySQL PDO fetch types, whether it be returning just one row, one column or looping through a full table SELECT call. The common 3 fetch types:…
A PHP function to help reduce the load of duplicate code when producing HTML tables. This works by looping through an array for the thead (columns <–>) and then the…
How to Autofill or auto-complete an HTML input form using JQuery with PHP and MySQL. This method uses LIKE in a MySQL query for the typed in characters and returns…
Converting hours, minutes and seconds (H:i:s) string to just seconds with PHP can be done with an adaptable function that also works for just a minutes and seconds string. The…
Roll back a MySQL transaction with the PDO rollBack() function. All that is needed is beginTransaction. Start a transaction and run a query that modifies a table: $db->beginTransaction(); $update =…
How to generate a random time from an H:i:s formatted timestamp with PHP. For this example 02:38:55 will be used which represents 2 hours, 38 minutes and 55 seconds. The…
A simple PHP function to convert and format Bytes to Megabytes, Gigabytes and Terabytes: function convertBytes(int $bytes, string $convert_to = ‘KB’, bool $format = true, int $decimals = 2): float…