mysql - i want to update only one table field on name field value -
here there 1 table having field id, name,value. there 1 form field meta title, meta description, when insert values insert
id name value 1 meta title testtitle(this value of textbox of meta title in form) 1 meta description testdes
insert , delete function working correctly edit/update function not working properly. here update function :
function mysql_updatemetapost($db, $columns) { $sql = ""; foreach ($columns $obj) { $sql = "update user_metapost set value = '{$obj['value']}' user_postid='" . $obj['user_postid'] . "' , name= '" . $obj['name'] . "'"; $result = mysql_query($sql, $db) or die(mysql_error()); } return $result; }
columns array contain data of form. here when updating records name field value(meta title,meta description) should not change, here in code problem when update insert last value of columns array, means meta description updated, example :
after update table data :
id name value 1 meta description updateddes(this value of textbox of meta title in form) 1 meta description updateddes
Comments
Post a Comment