Title: ask about use api to insert_data
Last modified: August 22, 2016

---

# ask about use api to insert_data

 *  [eastevil](https://wordpress.org/support/users/eastevil/)
 * (@eastevil)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/ask-about-use-api-to-insert_data/)
 * would you please tell me how can i use api methods to insert_data ? example api
   call ..
 * [https://wordpress.org/plugins/custom-database-tables/](https://wordpress.org/plugins/custom-database-tables/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [ka2](https://wordpress.org/support/users/ka2/)
 * (@ka2)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/ask-about-use-api-to-insert_data/#post-5911187)
 * Hi there,
    Thank you for your inquiry.
 * The example of when want to insert from as “functions.php” of your theme are 
   as follows:
 *     ```
       <?php
       global $cdbt;
       $table_name = "my_table";
       $insert_id = $cdbt->insert_data($table_name, array('column1' => 'value1', 'column2' => 'value2'));
       echo $insert_id;
       ```
   
 * The example of when want to insert using a Web-api are as follows:
 *     ```
       <?php
       $url = 'http://your.web.site/?cdbt_api_key=<API key>&cdbt_table=my_table&cdbt_api_request=insert_data&data={column1:value1,column2:value2}';
       $response = file_get_contents($url);
       var_dump($response);
       ```
   
 * Please try an above.
 *  Thread Starter [eastevil](https://wordpress.org/support/users/eastevil/)
 * (@eastevil)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/ask-about-use-api-to-insert_data/#post-5911426)
 * ＠ka2
 * many thanks it’s work ^^

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘ask about use api to insert_data’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-database-tables_e4e2e2.svg)
 * [Custom DataBase Tables](https://wordpress.org/plugins/custom-database-tables/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-database-tables/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-database-tables/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-database-tables/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-database-tables/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-database-tables/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [eastevil](https://wordpress.org/support/users/eastevil/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/ask-about-use-api-to-insert_data/#post-5911426)
 * Status: not resolved