SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Sep 2005
    Posts
    19
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Copying and renaming database with php

    I need to automate signup for my Saas application. The part i am at now is using php to copy a database and rename it for the new company signing up.
    Has anyone had the experience of doing this all ready?
    database naming is data_companyname

    Thanks for all the help

  2. #2
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    4,904
    Mentioned
    93 Post(s)
    Tagged
    0 Thread(s)
    You could (after having created the new (copy) database:


    • generate a SHOW CREATE TABLE query for each table in the database to be copied
    • Run the output of the SHOW CREATE TABLE queries against the new database.
    • Use SELECT INSERT queries to copy the data across for each table (you might want to block entry or editing of any data from the origin database whilst copying the data across to be 100% sure that you're copying it all across).
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator


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
  •