What's wrong with this code: case "new": if ($_GET['task'] == "process") { $date = date("F jS, Y"); $sql = "INSERT INTO announcements (title,date,content,group_id) VALUES ('$_POST[title]','$date','$_POST[content]','$_POST[group]'); if (mysql_query($sql)) { displayAlertMessage("green","Announcement Successfully Created"); } else { displayAlertMessage("red","A problem occured while creating the announcement, please try again."); } } else { include_once('include/something.inc'); } break; PHP: It keeps giving this error:
You're missing a ". case "new": if ($_GET['task'] == "process") { $date = date("F jS, Y"); $sql = "INSERT INTO announcements (title,date,content,group_id) VALUES ('$_POST[title]','$date','$_POST[content]','$_POST[group]')"; if (mysql_query($sql)) { displayAlertMessage("green","Announcement Successfully Created"); } else { displayAlertMessage("red","A problem occured while creating the announcement, please try again."); } } else { include_once('include/something.inc'); } break; PHP:
It was at the end of the "INSERT INTO announc.... statement. I added it in the code that I posted. //this was the bad code $sql = "INSERT INTO announcements (title,date,content,group_id) VALUES ('$_POST[title]','$date','$_POST[content]','$_POST[group]'); //should have been $sql = "INSERT INTO announcements (title,date,content,group_id) VALUES ('$_POST[title]','$date','$_POST[content]','$_POST[group]')"; PHP:
give ' ".$_post['value']." ' inside of mysql then only it give take string value otherwise it will integer .