Posted By

sveggiani on 01/05/09


Tagged

strings evFunctions


Versions (?)

evCleanSQL | cleans a SQL query


 / Published in: PHP
 

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

  1. // name: evCleanSQL
  2. // version: v0.1
  3. // description: limpia un string para una consulta SQL
  4.  
  5. function evCleanSQL( $sql ) {
  6.  
  7. // si magic quotes está en ON
  8. $sql = stripslashes( $sql );
  9. endif;
  10.  
  11. // Si PHP > 4.3.0
  12. if ( function_exists( "mysql_real_escape_string" ) ) :
  13. $cleanSql = mysql_real_escape_string( $sql );
  14. else :
  15. // si PHP version > 4.3.0
  16. $cleanSql = addslashes( $sql );
  17. endif;
  18.  
  19. return $cleanSql;
  20. }

Report this snippet  

You need to login to post a comment.