Return to Snippet

Revision: 10589
at January 5, 2009 09:51 by sveggiani


Initial Code
// name:      	evCleanSQL
// version:	v0.1
// description:	limpia un string para una consulta SQL

function evCleanSQL( $sql ) {

    // si magic quotes está en ON
	if ( get_magic_quotes_gpc() ) :
		$sql = stripslashes( $sql );
	endif;

	// Si PHP > 4.3.0
	if ( function_exists( "mysql_real_escape_string" ) ) :
		$cleanSql = mysql_real_escape_string( $sql );
	else :
		// si PHP version > 4.3.0
		$cleanSql = addslashes( $sql  );
	endif;

	return $cleanSql;
}

Initial URL

                                

Initial Description
warning! not tested, I'm not an expert on this field

Initial Title
evCleanSQL | cleans a SQL query

Initial Tags

                                

Initial Language
PHP