colap Posted February 7, 2011 Share Posted February 7, 2011 Can anyone post a generic update function to update mysql table. The manual approach: update $tablename set $column1='a', $column2='b' where $id=$value; Link to comment https://forums.phpfreaks.com/topic/226973-need-a-generic-update-function-to-update-a-mysql-table/ Share on other sites More sharing options...
ManiacDan Posted February 7, 2011 Share Posted February 7, 2011 You're going to have to be more specific. You can write a function that will accept an associative array and will construct an update statement. However, you won't be able to write it to have intelligence about the data type for the queries without doing a SHOW CREATE TABLE and parsing it yourself. -Dan Link to comment https://forums.phpfreaks.com/topic/226973-need-a-generic-update-function-to-update-a-mysql-table/#findComment-1171052 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.