Create Dynamic SQL Update Query in PHP and MySql

Previous part I have described how to Create Dynamic Insert SQL script Using PHP query.Now we will create dynamic update sql query based on data and table name.

Simple MySQL Update Query Example
if table has 2 column, one is name and another column name is age. Then data array should be array('name' => 'parvez', 'age' => '26').
The function takes three argument:
1 – first one is table name where it will insert
2- $data what will insert.$data is a key value pair of array.
3- other is Where condition and so first we will separate key and value from data array.Now we will implode key and values of arrays with where condition and create a string of update sql.

Checkout other dynamic MySQL query tutorials,

Source Code to create dynamic update Query using php and MySQL