So I have a little function I use all-the-time.

function encodeSQL($data) {
	return mysql_real_escape_string($data);
}

This little guy gets used whenever and wherever I need to be sure that whatever I’m using in my sql queries is safe.  Is it really all that helpful?  No.  Does it save me from writing mysql_real_escape_string a zillion times?  Yes.  Does it make my code writing a little easier, a little faster?  Yes.

My point here is that if you have things that you do a lot, go ahead and write little functions for them.  Then, re-use those functions across projects if they were really well written.  Just remember that whatever you write should be easily understandable.

March 29th, 2013

Posted In: Shortcuts

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: