How to Stop SQL Injection in MYSQL?

Posted by om 9 August, 2009

Every PHP-MYSQL programmer need to know Anti-SQL Injection.

Please take a look at very simple function which can save your database!!

<?Php
 
function ClearInput($dirty){
 
	if (get_magic_quotes_gpc()) {
 
	$clean = mysql_real_escape_string(stripslashes($dirty));
 
	}else{
 
	$clean = mysql_real_escape_string($dirty);
 
	}
	return $clean;
 
}
 
?>
  • Share/Bookmark
Categories : Easy PHP,MySQL,PHP Tags :

Comments
August 21, 2009

where do i put this code??? if in mysql how to input using sqlyog

Posted by ivan
August 21, 2009

Sqlyog is GUI tools to mange MySQL and you can administrate like phpmyadmin.

Above code you can use when you are creating/writing code using php and mysql.

Can you execute php code using Sqlyog ?

Posted by om
Leave a comment

(required)

(required)