I am using tiny mce with a script I built for uploading some content to a blog like system. Whenever I add a link via tiny mce I get this error. The field type in mysql for $content which is the one carrying the link is longblob if that helps.
here is the link error first and then my code
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 'google test" href="http://www.google.ca" target="_blank">google est laborum' at line 4
/* GRAB FORM DATA */
$title = $_POST['title'];
$date = $_POST['date'];
$content = $_POST['content'];
$imageName1 = $_FILES["file"]["name"];
$date = date("Y-m-d");
$sql = "INSERT INTO blog (title,date,content,image)VALUES(
\"$title\",
\"$date\",
\"$content\",
\"$imageName1\"
)";
$results = mysql_query($sql)or die(mysql_error());
UPDATE: how would I go about doing the same mysql escape with sprintf when I am doing a UPDATE WITH A WHERE statement currently I am getting the error
Warning: sprintf() [function.sprintf]: Too few arguments in /home/akitson1/anderskitson.ca/admin/blogEdit.php on line 88
Query was empty
$sql = sprintf("UPDATE blog SET WHERE id=$thisID (title,date,content,image)VALUES('%s','%s','%s','%s')",
mysql_real_escape_string($title),
mysql_real_escape_string($date),
mysql_real_escape_string($content));