Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8765705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:21:22+00:00 2026-06-13T16:21:22+00:00

i m trying to add custom list of tags using excel file and I

  • 0

i m trying to add custom list of tags using excel file and I have done most of the work. but i am confused that how can I add same value in 2 different tables columns.

i had inserted the values in

INSERT INTO `steve`.`wp_terms` (`term_id`, `name`, `slug`, `term_group`) VALUES (NULL, 'tag99', 'tag99', '0');

and

INSERT INTO `steve`.`wp_term_taxonomy` (`term_taxonomy_id`, `term_id`, `taxonomy`, `description`, `parent`, `count`) VALUES (NULL, '21', 'post_tag', '', '0', '0');

now i want to add term_id in both table .. could somebody tell me how can i do that?

AND term_id is database generated value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:21:23+00:00Added an answer on June 13, 2026 at 4:21 pm
    INSERT INTO `steve`.`wp_term_taxonomy` (`term_taxonomy_id`, `term_id`, `taxonomy`, `description`, `parent`, `count`) VALUES (NULL, LAST_INSERT_ID, 'post_tag', '', '0', '0');
    

    If I follow correctly your first query inserts into a table and creates a new id for that record, then you want to use that ID in the next query to insert into a different table right? If that’s the case the above query should work for your second one using LAST_INSERT_ID for the term_id value.

    To update the question with your new code it should, I emphasize should, work with this:

     $sql2 = "INSERT INTO " . $table2 . " (`term_taxonomy_id`, `term_id`, `taxonomy`, `description`, `parent`, `count`) VALUES (NULL, LAST_INSERT_ID, 'post_tag', '', '0', '0')";
    
            $wpdb->query($sql);
            $wpdb->query($sql2);
    

    The way you have it above you are overwriting your first query before you execute it.

    Also I don’t understand how you’re inserting nulls into an auto-increment field, that alone should be throwing an error. Honestly both your queries should be leaving their base ids (the auto increment ones) out of the query entirely like this:

    $sql2 = “INSERT INTO ” . $table2 . ” (term_id, taxonomy, description, parent, count) VALUES (LAST_INSERT_ID, ‘post_tag’, ”, ‘0’, ‘0’)”;

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add custom fields to an InlineFormset using the following code, but
I'm trying to have my AlertDialog with a custom list view but can't seem
I am trying to add a custom property to a base form that can
I am trying to add a custom style to each list item within Joomla!s
I'm trying to add some custom methods to my controller, but I'm encountering the
I have a custom list definition, and I am trying to rename the custom
I am trying to add an custom action to a resource but I get
I am trying to conditionally build a custom list using <ui:repeat> . On every
I am trying to add a view to a custom list. The target is
1 ) I am trying to add my custom menus to the menu list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.