Inserting data into a table in WordPress database using WordPress $wpdb

后端 未结 4 1939
名媛妹妹
名媛妹妹 2021-02-04 07:46

I am starting out plugin development and have followed the tutorials on the WordPress Codex sites. I am now stuck - I have a database called \"wp_imlisteningto\", where the

4条回答
  •  礼貌的吻别
    2021-02-04 08:41

    I think there are 2 mistakes in you sql string.

    Think it should be the $table_name variable should be concatenated

    $sql = "CREATE TABLE" . $table_name . "(
    id mediumint(9) AUTO_INCREMENT,
    album VARCHAR(50),
    artist VARCHAR(50),
    PRIMARY  KEY (id)
    )";
    

    and remove ; on the last line.

提交回复
热议问题