Escape special character in mysql query


by Php Ninza on July 14, 2009

Mysql throw error when there are special characters in query !, The characters like “`” etc are always a nuisance in sql queries.

For this reason , it’s always a necessity to use mysql_real_escape_string() (www.php.net/mysql_real_escape_string) ! , On one hand it’s secure and make sure that the queries don’t die while executing.

The syntax that should be used for mysql_real_escape_string are :-

<?php

$string =  mysql_real_escape_string ($string);

?>

Hope it helps !…..

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay

Leave a Comment

Previous post:

Next post: