PHP/MySQL update statement inserting a 0? -


i creating "edit" page content on website stored in mysql database. can without problems reason having annoying problem here it.

i have title , message boxes wish update in database , when update query sent, title saved correctly, message seems add single "0" field?

here php validation removed (the problem still occurs without it):

if(isset($_post['savechanges'])){  $title = mysql_real_escape_string(stripslashes($_post['message'])); $message = mysql_real_escape_string(stripslashes($_post['title']));  $savequery = "update messages set message = '$message' , title = '$title' id = '$postid'"; $saveresult = mysql_query($savequery);  if($saveresult){ //do } else if(!$saveresult){ //do } } 

html form:

<form action="edit.php" method="post">    <input name="title" type="text">     <textarea name="message"></textarea>     <button type="submit" name="savechanges"> save changes </button> </form> 

was hoping had came across problem before, there no errors when i've tried debug, has ran success messages on completion , data add correctly title i've said, message adds "0".

your update statement should use comma instead of and:

http://dev.mysql.com/doc/refman/5.0/en/update.html

$savequery = "update messages set message = '$message', title = '$title' id = '$postid'"; 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -