1. Home
  2. Docs
  3. Simpods MVC
  4. Tutorials
  5. Featured Methods
  6. general_update_fn()

general_update_fn()

general_update_fn is built to update data in the database. If it is prefixed with general_ instead of simpods_, it means that it only works for one database table and tables in relationship are not taken into account.

Parameters

general_update_fn accepts five parameters:

general_update_fn( $table_str, $data_arr, $where_arr, $show_bln = false, $prefixMe_bln = true );
  • $table_str: the target table to update
  • $data_arr: Pass in the fields and values in an associated array to update, in this format: array(‘key’ => ‘value’).
  • $where_arr: Pass in an associated array to to tell the function where to update, in this format: array(‘field_name’ => ‘value’).
  • $show_bln: Default to false. If set to true, the SQL query will be displayed on the screen, for debugging purpose.
  • $prefixMe_bln: Default to true. If set to false, the function won’t automatically prefix $table_prefix to the ‘target_tb’ in the $atts_arr array. It is useful if you are querying a database table that are not designed for WordPress.

Return

This function will return a Boolean – updated successfully or failed.