7
2013
Updated MySQLi Database Class
Since I posted my mysqli database class originally on February 18th, I’ve gotten some great feedback, and A LOT of downloads, which is amazing! As a side note, I recommend always grabbing this class from the github repo at https://github.com/bennettstone/simple-mysqli I’ve also been using my own class on a large number of websites, and through the course of normal usage, and user feedback, I have made some changes… The error reporting has been enhanced to […]
18
2013
Custom PHP MySQLi Database Class
Updated class files (documentation remains the same) with better error handling and full OOP class structure can be found here. Since the depreciation of the mysql functions in PHP (archive here), I thought it may be handy to more effectively future-proof my web applications by wrapping my database interactivity functions in a class (and oh how it is!), and as I was building a new web framework anyway- I figured why not! Unrelated: featured image […]
16
2011
Helpful MySQL Query Functions and Tips
In case you’re wondering, I don’t just spend a couple hours a week throwing random bits of code onto this blog- I spend anywhere between 60- 100 hours per week making code my bitch. But thousands of hours and millions of lines of code later, I’m still occasionally stuck trying to remember a query (but then again when you’ve got most of the MySQL manual embedded in your brain, the info becomes hard to sort […]
13
2011
MySQL Query Results From Date Range
It’s often unnecessary to select EVERYTHING from the beginning of your database table when performing queries, and depending on how much information your database contains- you’re likely displaying more results than anyone cares about! But alas, there is a better way! The following queries are very straighforward, specifying that the query should scan your database table date field (‘date_field’) for results that are greater than, or equal to the current date and time (‘NOW()’), and […]
2
2011
Better date time display using MySQL query
So, you’ve got your database entries entered, optimized, and in the MySQL friendly 0000-00-00 format- but database date formatting just isn’t doing it for you on output? Using a quick trick within a MySQL query, we can easily convert that boring date into something a little more friendly and readable. Adding the “DATE_FORMAT” parameter to your query allows you to specify the conversion, leaving nothing for you to do except use your php to output. […]
Recent Snippets
- htaccess : Only allow access to specific wordpress upload types if logged in
- MySQL : Query WordPress Database for Invalid Media Filenames
- PHP : Get Actual IP Address with PHP
- JavaScript : Allow Tab in Textarea
- PHP : Clean sanitized database contents on output
- htaccess : Force www. prefix in URIs
- PHP : Force File Download with Correct Content Type
- Wordpress : Disable upgrade notification