Re: I need a fresh look at storing variables in MySQL

From: Date: Sun, 14 Mar 2010 11:14:08 +0000
Subject: Re: I need a fresh look at storing variables in MySQL
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-302795@lists.php.net to get a copy of this message
On Sun, Mar 14, 2010 at 11:16 AM, Ashley Sheridan <ash@ashleysheridan.co.uk>wrote: > That function won't always work. You're using a PHP version check for > mysql_real_escape_string() when the most likely failure point for it is if > no database connection has been opened. > I never call it without an open db connection.. > > Also, you shouldn't strip the tags from a string that's being inserted into > the database. strip_tags() is for the display of data on a web page. It's > best practice not to alter the actual data you've stored but to convert it > once it's displayed. Don't forget that the browser display may not be the > only use for that data. > Let's call that a coder's / payer's preference.. If i'd need human text, i'd want to strip it of computer code before it enters the db. Possibly log the attempt to insert code.

« previous php.general (#302795) next »