lszanto Posted March 19, 2007 Share Posted March 19, 2007 Every time I edit news on my news system for some reason it has no error but it doesn't update the news, this is the code that updates it. if(isset($_POST['subed'])) { //Get vars. $id = $_POST['id']; $day = $_POST['day']; $title = $_POST['title']; $post = $_POST['post']; $month = $_POST['month']; //Make insert query. $sql = "UPDATE news SET month='$month' AND day=$day AND title='$title' AND post='$post' WHERE id=$id"; //Insert data. mysql_query($sql) or die(mysql_error()); //Tell user data has been entered. echo "The news has been edited, please click <a href=\"news.php\" >here</a> to view the news."; } Link to comment https://forums.phpfreaks.com/topic/43331-unknown-mysql-error/ Share on other sites More sharing options...
mmarif4u Posted March 19, 2007 Share Posted March 19, 2007 Every time I edit news on my news system for some reason it has no error but it doesn't update the news, this is the code that updates it. if(isset($_POST['subed'])) { //Get vars. $id = $_POST['id']; $day = $_POST['day']; $title = $_POST['title']; $post = $_POST['post']; $month = $_POST['month']; //Make insert query. $sql = "UPDATE news SET month='$month' AND day=$day AND title='$title' AND post='$post' WHERE id=$id"; //Insert data. mysql_query($sql) or die(mysql_error()); //Tell user data has been entered. echo "The news has been edited, please click <a href=\"news.php\" >here</a> to view the news."; } Try this: $sql = "UPDATE news SET month='$month' AND day='$day' AND title='$title' AND post='$post' WHERE id='$id'"; Link to comment https://forums.phpfreaks.com/topic/43331-unknown-mysql-error/#findComment-210400 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.