Create Dynamic SQL Update Query in PHP and MySql

Previous part I have described how to create dynamic insert sql query.Now we will create dynamic update sql query based on data and table name.

Example

if table has 2 column name and 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 in php and Mysql