Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi Matty,

    Yes, both

    require_once('../../../wp-config.php');
    require_once('../../../wp-load.php');

    work.
    And require_once(...) is very critical, without this line, the insert does not work! will get an error.

    I tried another code, which also worked.

    <?php
    require_once('/Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-config.php');
    // change to your own directory if necessary
    global $wpdb;
    $table = $wpdb->prefix."main_table"
    $wpdb->query("INSERT INTO $table (album, artist) VALUES ($_POST['album'], $_POST['artist'])");
    ?>

    Hi Matty,

    Thanks for your update, the problem seems that “array( ‘$s’, ‘$s’ )” should not be inserted into the $table_name.

    Very helpful.

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