Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author ka2

    (@ka2)

    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 = 'https://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

    (@eastevil)

    @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.