Hey Guys,
Trying to make a script where i just fill a textarea in and sends the text into a database, but the problem i have is when there is any ' in the text i got the error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 're firmly established at the very heart of British life, providing the freshest ' at line 1
but if i dont use ' it goes in fine? Can anyone help?? my text is below
PHP Code:
<?PHP
include ("includes/db.php");
$id2 = $_POST['id2'];
$free_text = $_POST['free_text'];
$awards_text = $_POST['awards_text'];
$table_name = "baccount";
$connection = @mysql_connect($dbserver, $dbuser, $dbpass) or die ("Couldn't Connect to database");
$db = @mysql_select_db($dbname, $connection) or die(mysql_error());
$sql = "UPDATE $table_name set free_text= '$free_text', awards_text= '$awards_text' WHERE id = '$id2'";
$result = @mysql_query($sql,$connection) or die(mysql_error());
?>
Can someone have a look at my code and see what i need to do?
Thank you in advanced