Solved

Moving Data in PHP MySQL from one table with records to the same named table with no records

Posted on 2013-06-06
8
294 Views
Last Modified: 2013-06-10
I have a database i have installed with a product open source Bug Ticketing system called Mantis. I installed Mantis on a new website with a new ISP. (no Records in this DB) The old ISP had the same version of Mantis with just a few records in it I wanted to move those records....that data to the new site. Is this possible if so how do I do that. Please advise thank you.
0
Comment
Question by:ruavol2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 31

Assisted Solution

by:Frosty555
Frosty555 earned 167 total points
ID: 39227141
If this is a one-time thing, the easiest way to do it is to mysqldump the contents of the old table, manually edit the .SQL dump file to have the new database/table name, and then execute the dump query against your MySQL server.

If you have PHPMyAdmin installed, you can use the Export/Import options to do this, otherwise you can use the mysqldump command line utility on your server

http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html
0
 

Author Comment

by:ruavol2
ID: 39227180
I have already imported the tables they are in the DB twice. In fact they have a weird icon and the column under the PHP MyAdmin Table list on the far left. See image attached.
So the tables are in there twice. One empty and one with records. Is there a simply way to say put these records in that table with the same name......? Like Mantis_Users    to   Mantis_Users

Note the highlighted area in yellow and the Mantis (31) representing the tables I imported with records the Mantis Tables at the higher level are the tables I installed to for the website and are empty........? Does that help
PHPMyAdmin-Mantis.png
0
 
LVL 110

Assisted Solution

by:Ray Paseur
Ray Paseur earned 166 total points
ID: 39227244
Hmm... Some of the tables seem to have a single underscore in the name and others seem to have a double underscore.  Am I seeing that correctly?
0
Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

 
LVL 58

Expert Comment

by:Julian Hansen
ID: 39227330
0
 

Author Comment

by:ruavol2
ID: 39227444
julianH Yes I do but that seem to not be answered about a data merge but a table merge. This question asks only about merging the data.

Ray_Paseur Yes there seems to be a double underscore there. Yes and I see why the double underscore seems to signify where the imported tables are They seem to follow the Mantis (31)  tables that are there and flow to the bottom of the 31 list.
0
 
LVL 58

Accepted Solution

by:
Julian Hansen earned 167 total points
ID: 39227528
I think Ray has spotted the problem. Just checked the data you posted in my db and the tables have double underscores.

What is the correct name for the tables - with or without double underscores?

You could probably do a search and replace on the sql file you posted - but I had to kill my text editor while editing that file - it choked after I got 1500 or so lines down. Might be easier to just delete the tables that are there and rename the new ones.

With regard to merging - at the data level you will need a script - PHPMyAdmin just runs SQL queries and the ones in the export dump are create and insert statements - so they will overwrite / add to what you have but won't merge - but from what I gather the other tables are throw away anyway?
0
 

Author Closing Comment

by:ruavol2
ID: 39236480
Thanks to you guys I figured it out. It would seem all I had to do was to delete or drop the empty tables in PHPMyAdmin and then go in and rename the tables by removing the "extra underscore" created apparently by the import. The import put a Mantis__??? infront of the imported tables. It seems to have worked by simply removing the one underscore. Thanks for your help gentlemen....
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39236515
Glad you got it pointed in the right direction!  Best regards, ~Ray
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question