note 70441 deleted from function.mysql-real-escape-string by danbrown

From: Date: Sat, 14 Mar 2009 15:06:48 +0000
Subject: note 70441 deleted from function.mysql-real-escape-string by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151929@lists.php.net to get a copy of this message
Note Submitter: vbaspcppguy at gmail dot com ---- After reading through all the different versions I came up with this: function quote_smart($value) { if( is_array($value) ) { return array_map("quote_smart", $value); } else { if( get_magic_quotes_gpc() ) { $value = stripslashes($value); } if( $value == '' ) { $value = 'NULL'; } if( !is_numeric($value) || $value[0] == '0' ) { $value = "'".mysql_real_escape_string($value)."'"; } return $value; } } This version is a little slower but it will recursively handle arrays.

« previous php.notes (#151929) next »