Browsing articles tagged with "tips and tricks Archives - PHP Dev Tips"
Jun
29
2014

WordPress Syntax Highlighters, and how to Switch From One to Another

If you’ve been to this site before,  you’ll probably notice that I’ve switched from the syntax highlighter that I’d used to display code to something a ton cleaner (the credit does not go to me, the new syntax highlighting plugin came from this TutsPlus article). Until a few hours ago, I used SyntaxHighlighter Evolved, which looked great, and was super easy to use, however, there were some issues with using it on a website displaying code that people […]

Jun
20
2014

My favorite tools for Web Development

The question that I get asked more than any other is, “What tools do you use to code?”, so I figured I’d spread some software/knowledgebomblove and lay out my workflows! I’ll also break it down by the actual order of my workflow (since that’s a bit easier for me to write/remember anyway): Textmate I code by hand, and since I code by hand, Dreamweaver isn’t even a thing that exists on my computer.  I use […]

Jun
8
2013

Awesome Email open tracking with PHP and MySQL

Sometime last year, I wrote about super awesome email open tracking using PHP and MySQL, and I’ve since ALSO updated that one to be EVEN MORE SUPER AWESOME! Tracking email open rates is both very valuable, and very useful, particularly if you run a service where statistics are important, or in scenarios where more detailed information on users (namely their participation with site content outside the website is crucial). That being said, a couple things […]

May
20
2013

Simple session based “flash” messages

Quite a while ago, I grew tired of trying to come up with new and creative ways to display simple, one-time messages to users without crazy amounts of code for something that was frequently as trivial as “Saved!”. Sessions are the obvious solution, however, without a single function that could both generate, AND display the messages, it still wasn’t any better.  And as usual, where there’s a will, and some code- there’s a way! Before […]

Feb
4
2013

Using PHP to output images (AWESOME STYLE)

Don’t get me wrong, I’m not lazy, but I’m also NOT a front end designer or HTML guru. So when it comes to repeating tasks endlessly that are even mildly lengthy- I get bored. That’s right, I said it- b.o.r.e.d. Tonight was a perfect example! As a back end engineer, I’m nearly always provided very tidy, but elaborate HTML assets, which are then on my desk to become amazing and highly functional beings. But after […]

Aug
25
2011

Using PHP to Replace Special Characters with their Equivalents

PHP Character Replacement

After having just completed an extensive text file parsing script, I discovered something very very very annoying.  A small army of Microsoft Word inspired characters had invaded the imported plain text files (courtesy a number of citation management softwares and websites), causing text to have all sorts of ‘fun’ symbols sprucing things up. For example “Tâ��ms” => “Teams”, but with that extra something added in for visual highlight (or something). So what was a programmer […]

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
29
2011

Get Location From User IP Address

IP to Location Function Image

For many of the websites that I work with and manage, IP addresses are collected; primarily as a means to combat spammers, secondarily because it’s always interesting to

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

Pages:12»