James John – Software Engineer

Archives

PHP

How I Created AWS S3 Hierarchical File System Using PHP

Story cut short, I got a project to pull files from Amazon S3 and allow users to navigate into sub-directories knowing S3 is a Flat file system. I wrote some PHP functions to take the folders and make them array keys of an multidimensional array. The plan was the put the files into the arrays […]

WP Meta Query: Query to Strictly Get Not Existing Meta Key and Value

This is the second time I am working on a plugin project like this, first time I don’t remember the project so I couldn’t get back the code, had to rewrite it. This time I am making a post so I could come back to it in the future. So in this case, lets say […]

How to Escape MySQL REGEXP Strings in PHP

It’s usually weird with MySQL in everything I guess. Again, I ran into using Regex in MySQL using REGEXP which is pretty cool. MySQL escape strings with double backslash \\, unlike other programming languages using single slash. But the problem here is that the string to be escaped is in a PHP variable, how do […]

PHP-JSONDB: A PHP Class that Reads JSON File as Database

It’s funny though. One noon at Cafe Neo in Sabo, Yaba, I was waiting on my friend Magnus while he met his friend. Sipping my coffee and using my laptop, with the bad network there, I couldn’t browse with my GLO SIM; I then decided to play around. I exported my MySQL Database as JSON […]

MySQL2MySQLi: A Small Program to Help Migrate from PHP mysql_* to mysqli_*

Stumbled upon a very monstrous PHP project, very old of course, the client complained that the web host refused to downgrade the server for them and this project doesn’t work anymore because it was written with bunch of mysql_* depreciated function. Now it was my job to start editing these files one after the other, […]

PHP SiDB – A Simple Database Framework

With the purpose of faster work, I wrote this framework last year and I recognized it would be useful for others. What does it do? SiDB makes it faster to Insert data to Database Retrieve data from Database Delete data from Database Run other queries All happens in just a line and no worries of […]

A Simple PHP Method to Insert data to Database Using Arrays

Write once, run everywhere. A friend has been struggling with this and I’m here to help 😀 . It’s been long and I decided to stretch out and use the opportunity to update my blog 😛 This is simple – view on Git USAGE:

NGStatesLGA: Nigerian 36 States & Local Government Areas PHP Class

Recently a friend of mine complained about this – not seeing States and LGA online for developers’ use. I took it upon myself to make this available to us and make work easier for us. It took me 3hrs to arrange it, which my source was from this site, thanks to them 🙂 How to […]

Simple PHP Mail Function Using Swift Mailer

Using the built-in mail() function is PHP is pretty cool but not cool if you’re sending bulk or large mails and secondly it always head for the Spam box 😀 because not all needed headers are there. But using a mailer, I use Swift Mailer and it’s cool for me, get Swift Mailer and also […]

ISO Alpha-2 Country Codes and Names in PHP Array

I sweated out arranging this but I think it’s gonna be useful to someone someday 🙂 This array can by handy if you create a function to get countries an HTML Option element and adding your selected, e.g below: I hope this helps 🙂