2014 version with mysqli_*, APC, and better style by Jay Tolentino