MySQL Database Php

Escapes a string for use in a mysql_query.
$item = "Laptop";
$escaped_item = mysql_escape_string($item);
printf ("Escaped string: %s\n", $escaped_item);
?>
Escape special characters in a string for use in a SQL statement, taking into account the current charset of the connection.
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
$item = "Laptop";
$escaped_item = mysql_real_escape_string($item);
printf ("Escaped string: %s\n", $escaped_item);
?>