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

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -