SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict kivison's Avatar
    Join Date
    Dec 2004
    Location
    Whitley Bay, Tyne & Wear, UK
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mysql and PHP to import client records

    Hello Gurus

    Just after some advice.

    I have made a database for a client and one of their suppliers have said that they like it and want it for their business too. ( Happy days )

    I need to transfer client records from CLient 1 to Client 2's database. The table structures are identical but obviously the row ID is different.

    the structure is
    table.client
    -client_id
    -name
    etc

    table.project
    -pro_id
    -pro_client_id -- taken from the mysql insert_id() from above
    etc etc

    My thought was to export 2 text files (from server 2) identified with the unique id (file123_1.txt and file123_2.txt) with the sql info in them as follows

    INSERT INTO table.client .... get the insertid and run the 2nd one INSERT INTO table.project

    FTP them from one server to the other then delete the original files. Then get a php script to include them (on server 1) and run the contents therefore importing them to company 1's database.

    Am I barking up the wrong tree and making things difficult or is there a simpler way that any of you know of.

    Thanks in advance

    Keith

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,069
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    I would disable auto-increment, import both tables, then setup auto-increment again (starting the seed at the next available number)
    http://dev.mysql.com/doc/refman/5.5/...increment.html


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •