Browsing articles tagged with "database entries Archives - PHP Dev Tips"
Jul
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 […]

Jul
13
2011

MySQL Query Results From Date Range

MySQL Database Table

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 […]

Jun
13
2011

Simplified Data Sanitizing

Data Sanitizing

Ever feel as though your copy-paste buttons are going to wear out because your form has 36 fields, and ALL that data has to be scrubbed clean and fully sanitized prior to database entry?  I feel your pain.  Actually, to be fair- I’ve felt your pain, but not anymore! Why do we need to sanitize and clean user input?  Because we can’t trust all users! Thanks to PHP’s handy ability to reference user created functions, […]

Jun
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. […]