I'm having some problems inserting a block of text from a form into a MySQL table. It doesn't have any problems unless I use an apostrophe in any of the text. Here is the script the form is using:
<?
$sql = "INSERT INTO my_table (time_date, content) VALUES ('$time_date', '$content')";
$connection = mysql_connect("localhost", "my_username", "my_password") or die ("Couldn't connect to server.");
$db = mysql_select_db("my_database", $connection) or die ("Couldn't select database.");
$sql_result = mysql_query($sql,$connection) or die ("Couldn't execute query.");
?>
I have PHP 4 and MySQL 3.22.27 installed on my server.
Please help me!
<?
$sql = "INSERT INTO my_table (time_date, content) VALUES ('$time_date', '$content')";
$connection = mysql_connect("localhost", "my_username", "my_password") or die ("Couldn't connect to server.");
$db = mysql_select_db("my_database", $connection) or die ("Couldn't select database.");
$sql_result = mysql_query($sql,$connection) or die ("Couldn't execute query.");
?>
I have PHP 4 and MySQL 3.22.27 installed on my server.
Please help me!