UPDATE News SET title = 'Halo' AND message = 'Testing Message'
WHERE id = '5' LIMIT 1
Okay, this is what echo $sql give back.
Okay, so I check my structure and here is what the field are
title= varchar(50)
message=blob
now the weird thing is that the Message field does NOT update at all and the title is still 0.
when I run my add-news script it still works and is able to add new, here is what I use to add news.
if(!mysql_query("INSERT INTO News (user, message, title, date)
VALUES ('$username', '$message', '$title', '$datetime')")){
print 'Data could not be updated'. mysql_error();
}
else print 'News has been updated';
Please let me know what you think. I am not getting ANY errors and this is what i get when I hit my Edit-news page.
The code I execute:
<?php
include'mconnect.php';
$id=$_REQUEST['editid'];
$title=$_REQUEST['title'];
$message=nl2br($_REQUEST['message']);
$sql = "UPDATE News SET title = '$title' AND message = '$message' WHERE id = '$id'";
echo $sql."<br />";
if (!mysql_query($sql)){
print "News did not update". mysql_error();
}
else{
print "News was updated ";
echo $title;
echo $message;
}
mysql_close($mconnect);
?>
The response when I hit the code page.
UPDATE News SET title = 'halo' AND message = 'Testing Message.'
WHERE id = '6' LIMIT 1
News was updated haloTesting Message.
Now just in case it helps, here is what my forum looks like
<form name="form1" method="post" action="editnews.php">
<input name="editid" type="hidden" value="<?php echo $postid ?>">
<input type="text" name="title" value="<?php echo $post['title'] ?>"><br>
<textarea name="message" cols="80" rows="15"><?php echo $post['message']?></textarea>
<br>
<input type="submit" name="Submit" value="Submit">
</form>
EDIT-- Edit the MySQL querry that updates, I removed Limit 1 as a Suggestion from sxooter.