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 8014553
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:58:16+00:00 2026-06-04T19:58:16+00:00

I’ve got a table that exists in both my live (hosted) DB and my

  • 0

I’ve got a table that exists in both my live (hosted) DB and my development (local) DB. I want to get a bunch of records into the live table.

What I’ve been doing is as follows:

  1. Export/Import a copy of the live table back to the dev DB using phpMyAdmin.
  2. Use a C batch file to load the new data into the dev table.
  3. Export/Import a copy of the updated dev table back to the live DB, again using phpMyAdmin.

This all works fine, as far as it goes.

The problem is this: if a record has been deleted in the live table, step 1 doesn’t remove it from the dev table (even if you choose the “Replace table with file” option). This record then gets recreated in the live table at step 3.

My question: should I truncate the dev table (after backing up, of course) before I import at step 1? Will my import set the auto-increment on the dev table to the same point as it is on the live table? Or am I about to stuff things up horribly?

Thanks.

EDIT: Here’s the table. (Can’t get it to format better; sorry.)

Column – Type – NULL – Default

cnum smallint(6) No
unum smallint(6) No
1
cat_subject smallint(2) No 0
cat_major smallint(2)
No 0
cat_minor smallint(2) No 0
cat_flavour char(1)
Yes NULL
unmod varchar(255) No

Index:

Keyname Type Unique Packed Column Cardinality Collation Null Comment

PRIMARY BTREE Yes No cnum 2214 A No

  • 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-04T19:58:17+00:00Added an answer on June 4, 2026 at 7:58 pm

    Truncating a table in MySQL will reset the autonumber/identity column. Unless your script explicitly inserts the autonumber from live into dev you are going to have a major problem on your hands.

    If you can post some table structures and code I would be able to give you a better answer with some code.

    UPDATE:

    Just to clarify a little about autonumbers and MySQL. Lets create a table as follows:

    CREATE TABLE `testcust` (
     `TestCustID` int(11) NOT NULL AUTO_INCREMENT,
      `Name` varchar(32) DEFAULT NULL,
     PRIMARY KEY (`TestCustID`)
    ) ENGINE=InnoDB;
    

    If I inserted data with the following query:

    INSERT INTO `test`.`TestCust`
    (`TestCustID`,
      `Name`
    )
    VALUES
    (
      NULL,
     'Pieter'
    );
    

    And ran a select * on this table I would see something like this.

    TestCustID     Name
     '1',          'Pieter'
    

    Since I did not specify the TestCustID MySQl will generate one. If I ran the following insert query:

    INSERT INTO `test`.`TestCust`
     (`TestCustID`,
      `Name`
     )
     VALUES
     (
         15,
         'Pieter'
     );
    

    And then ran a select * on the table I would see

    TestCustID     Name
     '1'          'Pieter'
     '15'         'Pieter'
    

    So if you truncated your table it will reset the TestCustID to 1(starting from scratch).If you explicitly specify the autonumber from your production/live system in your insert statements you will be in sync if you dont specify your autonumbers in the insert statements you will go out of sync.

    Hope that clarifies it a bit more.

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I want to count how many characters a certain string has in PHP, but
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I am doing a simple coin flipping experiment for class that involves flipping a

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.