Tutorials

Moving servers without phpMyAdmin

This tutorial will explain how to move your member list from one database to another without using phpMyAdmin. This will be useful to you if you are hosted at a domain and need to move your fanlisting for whatever reason, or if you don’t like/don’t understand phpMyAdmin.

Basically, what this tutorial will do is explain how you can display your members list in a format that you can copy and paste and then upload to your server and it will add the members for you. You need to have the tables created in the new database for this to work.

  1. Copy and paste this to a blank file:

    <?php require_once("config.php");
    print("<p>");
    // if fave is enabled
    if ($enablefave == 'Y'){
    $result = mysql_query ("SELECT * FROM $table");
    if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_array($result)){ ?>
    
    ('', '<?php echo addslashes($row["name"]); ?>', '<?php echo $row["email"]; ?>', '<?php echo $row["url"]; ?>', '<?php echo $row["country"]; ?>', '<php echo addslashes($row["comments"]); ?>', '<?php echo $row["hideemail"]; ?>', '<?php echo $row["apr"]; ?>', '<?php echo addslashes($row["fave"]); ?>'),<br />
    
    <?php
    }
    }
    else {
    echo "This table is empty.";
    }
    }
    else {
    // if it's not
    $result = mysql_query ("SELECT * FROM $table");
    if (mysql_num_rows($result) > 0) {
    while ($row = mysql_fetch_array($result)) { ?>
    ('', '<?php echo addslashes($row["name"]); ?>', '<?php echo $row["email"]; ?>', '<?php echo $row["url"]; ?>', '<?php echo $row["country"]; ?>', '<?php echo addslashes($row["comments"]); ?>', '<?php echo $row["hideemail"]; ?>', '<?php echo $row["apr"]; ?>'),<br />
    
    <?php
    }
    }
    else {
    echo "This table is empty.";
    }
    }?>

    Name it whatever you want, but it absolutely has to have a .php extension! For purposes of this tutorial, I’m going to refer to it as print.php.

  2. Upload this file to your fanlisting folder – the one with config.php in it. Then just type the url in your browser and hit enter. It should display a line that looks like this:

    ('', 'Heather', 'heather@innocentia.org', 'http://innocentia.org', 'USA', '', 'n', 'y'),

    for each member of your fanlisting.

  3. Now, this is where it might start getting complicated. Copy the following into a second blank file:

    <?php require_once("config.php");
    mysql_query("INSERT INTO $table VALUES
    PASTE HERE
    ") or die(mysql_error());
    print ("Yay! It worked!");
    ?>

    Then, go back to print.php in your browser, and highlight and copy the entire thing and then paste it where it says "PASTE HERE," replacing "PASTE HERE" with the list.

  4. Go down to the bottom of the list of members, and on the very last member, there will be a comma after the closing parenthesis. Change that to a semi-colon. Example:

    ('', 'Heather', 'heather@innocentia.org', 'http://innocentia.org', 'USA', '', 'n', 'y'),

    Change to:

    ('', 'Heather', 'heather@innocentia.org', 'http://innocentia.org', 'USA', '', 'n', 'y');
  5. Save this file as something.php, upload it to your fanlisting directory, and type in the URL. This might take a while if your members list is huge. You should get a message saying "Yay! It worked" when it’s done adding them.

Comments

Error Comments are closed for this entry.