Jump to content

Unknown mysql error.


lszanto

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.