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

general_insert_fn()

general_insert_fn will insert data into a single database table.

Parameters

general_insert_fn accepts four parameters:

general_insert_fn( $table_str, $data_arr, $echoQuery_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 insert, in this format: array(‘key’ => ‘value’).
  • $echoQuery_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 is not designed for WordPress.

Return

This function will return an ID if successful, false if failed.