Table Transfer

Discussion in 'Databases' started by karyoker, Mar 17, 2007.

  1. #1
    Im tying ti integrate Helpdeskreloaded with a phpbb2 forum.. It will be for members only and want to use the forum database registry table forr desk also. I have tried for days to get the desk php to select from the forum table with no success..

    The fetch code for desk is
    $q = "select id from " . DB_PREFIX . "accounts where user = '" . mysql_real_escape_string($_POST['uname']) . "' and pass = '" . md5($_POST['upass']) . "' LIMIT 1";
    Code (markup):
    for some reason the mysql_real_escape_string is screwing me up...

    I would just like to select from the forum table and insert into the desk table.
    And as some joins insert into both tables id name pass user level and email addy..
    One problem is the colums are labeled different and not coincident ie A B C..

    I did find this code INSERT INTO _accounts (COL2, COL3, COL7, COL8) SELECT COL4, COL5, COL34, COL31 FROM phpbb_users but its for my sql
    Any suggestions for this old cofused mkind right now would be welcome..
     
    karyoker, Mar 17, 2007 IP
  2. karyoker

    karyoker Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Now trying a direct transfer between the tables
    mysql_query($query);
                     $result = mysql_query("SELECT  username FROM phpbb_users")
                or die(mysql_error());
    
                   while($row = mysql_fetch_array($result))  {
    
                    $query=("INSERT INTO accounts (User)
                       VALUES(".$row['username'].")")
                  or die(mysql_error());
                 echo $row['User'],"<br>Transfered";
            }
          ?>
    Code (markup):
    There are no errors but no transfer...echo $row['username'],after the while statement prints out the names from the select table. What do I need to put in VALUES?
     
    karyoker, Mar 19, 2007 IP
  3. karyoker

    karyoker Guest

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Solved:

             $query  = "SELECT username, user_password, user_email FROM phpbb_users";
                           $result = mysql_query($query);
    
    while(list($name,$pass,$email)= mysql_fetch_row($result))
    {
        echo "Name :$name " .
             "pass : $pass " .
             "email : $email <br>";
               $query=("INSERT INTO _accounts (User,Pass,email_addr)
                         Values ('$name','$pass','$email')");
                 mysql_query($query) or die('Error, insert query failed');
    }
          ?>
    Code (markup):
     
    karyoker, Mar 19, 2007 IP