MySQL

How to Stop SQL Injection in MYSQL?

Posted by om 9 August, 2009 (2) Comment

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 :

Commonly Used MySQL Commands.

Posted by om 20 January, 2009 (0) Comment

To login from linux shell -
Mysql>;  -h hostname -u root -p

List all available databases with that username.
Show databases;

To use a database -
Use dbname;

To see tables within selected database;
show tables;

To see table field formats;
describe [xyzTableName];

To delete database -
Drop database [xyzDatabase];

To delete a table –

Drop table [xyzTableName];

Show all data in a table –
SELECT * FROM  xyzTableName;

  • Share/Bookmark
Categories : MySQL Tags :