Hey need help please. I'm trying to join a sting then insert it in to my database here is what I have. $issue = "1"; $now = time(); mysql_query("INSERT INTO general (released, issue) VALUES ('$now', '$issue')"); $subject = "test"; $message = $_POST['message']; $message .= "<br /><br /><img src='/images/elogo.png' />"; $table = "general"; mysql_query("UPDATE $table SET subject = '$subject', message = '$message' WHERE released = '$now'"); PHP: The update query doesn't add anything however the inser query does. Basically how do I insert the joined string $message? Thanks!
Your concat'd string has single quotes in it, which is breaking the insert. You should escape the data, where possible too. Something like this will fix the problem, though you might also want to do this on subject (and ANY other user entered data). mysql_query("UPDATE $table SET subject = '$subject', message = '".mysql_real_escape_string($message)."' WHERE released = '$now'"); PHP: As a side note, you might also want to consider using mysql_error to check for errors in tthings like this; it might save you a lot of time. mysql_query("UPDATE $table SET subject = '$subject', message = '".mysql_real_escape_string($message)."' WHERE released = '$now'") or die(mysql_error()); PHP: