Results 1 to 3 of 3
  1. #1

    Simple way of updating MySQL tables?

    We have software in which when users signup for a phpBB forum, it creates them in a DB using this format: username_config, username_tablename, etc... Well, if we need to update the DB for every user, and we have 75 users, that would be a tedious task. Is there a simple way of updating the whole DB for certain tables using a query?

    For example, lets say I wanted to update everyone's _config table. I tried running,
    INSERT INTO *_config (config_name, config_value) VALUES ('board_disable_msg', '');
    INSERT INTO *_config (config_name, config_value) VALUES ('board_disable_mode', '-1,0');

    I thought maybe the * would act as a wildcard, but it didn't work.

    There has to be an easier way.

    LiquidBlueX Webhosting
    Every site begins with a dream. This is where your dream begins
    (877) 848-3852

  2. #2
    Join Date
    Apr 2005
    if the users are already there in the phpbb database, you can select the required data from it and write to a file.

    Once you have that , a simple shell script can be used to read from the file and insert the data as required to the new database

  3. #3
    Join Date
    May 2005
    Memphis, TN
    Use a PHP script
    $sql1 = "original query here to find the usernames";
    $query1 = mysql_query($sql1);
    while($row = mysql_fetch_assoc($query1)) {
       $sql2 = "INSERT INTO `" . $row[usr] . "_config` (config_name, config_value) VALUES ('board_disable_msg', 0)";
       $query2 = mysql_query($sql2);
       if(!$query2) {
          die("An error has occurred, was not able to insert data.  Dump: <br />" . $sql2);
       } else {
          echo "Successfully added " . $row[usr] . " to the new database. <br />";
    Thats roughly what you need. Then just point your broswer to it.

Posting Permissions

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