Jump to content

need help in update query


doforumda

Recommended Posts

hi i am using an update query but it is not working. it gives this error

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 'read='read' WHERE mid='2'' at line 1

 

here is my query

$mid = $_GET['mid'];
$msg = mysql_query("SELECT * FROM messages WHERE mid='$mid'") or die(mysql_error());
if(mysql_num_rows($msg) > 0) {
	$row_read = mysql_fetch_assoc($msg);
	$read_db = $row_read['read'];
	if($read_db == 'unread') {
		//echo "unread";
		$read = mysql_query("UPDATE messages SET read='read' WHERE mid='$mid'") or die(mysql_error());
	}
}

Link to comment
https://forums.phpfreaks.com/topic/206047-need-help-in-update-query/
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.