• Hello.

    I have a page with a form. I’d like when the user clicked on the submit button its data was sent to two different databases. I think this could be done via a function inside the functions.php file. Could anyone show me a simple and efficient way to do that?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • on wp-config.php,
    define(‘DB_NAME’, ‘db1’);

    put your database name over there where your wp_tbl1 exist.say db1.
    put this query together and when onclick event will oddours both will be fired.

    $wpdb->query(“INSERT INTO wp_tbl1 (ID, name) VALUES (NULL, ‘abc’)”);

    $wpdb->query(“INSERT INTO db2.wp_tbl2 (T_ID, emp_name) VALUES (NULL, ’employee name’)”);

    I hope this will help you.

    Thanks,
    Shyam

    Thread Starter marcrock

    (@marcrock)

    Hello, Shyam.
    Thank you very much for your reply. My client had urgency to solve that problem and he hired a programmer to do it. But I really appreciate your message and will be trying your solution. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Form sending data to two different databases’ is closed to new replies.