I’m having following data
$field = 'f1','f2','f3'; // (comma separated string)
$value = 'v1','v2','v3'; // (comma separated string)
Is there any shortcut method to generate update query like this.
UPDATE table set ($field = $value) where id =1;
This method is working on insert query, But i dont know how to use like this for update query.
I think the best way to approach things like this is by storing the data in associative arrays, not strings like you have used:
If you are doing this, you need to ensure that you escape the data as you build the array. Or better yet, use prepared statements.