[Help] SQL multiple database select statement

Results 1 to 7 of 7
  1. #1
    Member irishboy777 is offline
    MemberRank
    Aug 2007 Join Date
    coloradoLocation
    69Posts

    Post [Help] SQL multiple database select statement

    i know this sounds techy and all, but heres the rundown, i am about to put up a second realm, configured everything in ascent, made a second world and character database and tested everything, works great.

    Problem: on my website, how do i put in my php a statement that when a player puts in their info on the registration page, it will put the same information into to character databases

    anybody have any ideas? ive looked around for weeks now and have found nothing helpful so far, so here i am :juggle:


  2. #2
    Sorcerer Supreme grandmst20 is offline
    Member +Rank
    Feb 2007 Join Date
    427Posts

    Re: [Help] SQL multiple database select statement

    Use the same character database for both. Problem solved.

    Or if you absolutely want 2 databases I can find how to for you.

  3. #3
    Member irishboy777 is offline
    MemberRank
    Aug 2007 Join Date
    coloradoLocation
    69Posts

    Re: [Help] SQL multiple database select statement

    lol i would use the same database, but i have a blizlike and a 10x rate realms... if you could find it i would be eternally greatful!

    Edit: i know it sounds easy, but it is really hard, here is my php script

    <?php
    include('config.php');
    $query = @mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error());


    mysql_select_db("char");


    $login=$_POST['login'];
    $password=$_POST['password'];
    $email=$_POST['email'];
    $retype_pass=$_POST['retypepass'];
    $tbc=$_POST['tbc'];
    //$retypelen is the alternate of $retype_pass which i will use in the following syntax to check for field lenght (if the field is empty).Same for the others.
    $loginlen=strlen($login);
    $passwordlen=strlen($password);
    $emaillen=strlen($email);
    $retypelen=strlen($retype_pass);
    if ($password!==$retype_pass or $passwordlen!==$retypelen)
    {
    print '<font color="red" size="2"><b>The two passwords do not match.Please retype passwords..</b></font>';
    }
    else{
    IF ($loginlen > 0 && $passwordlen > 0 && $emaillen > 0 && $retypelen > 0)
    {
    $query = "insert into accounts(login,password,lastip,flags) VALUES ('".$login."','".$password."','".$_SERVER['REMOTE_ADDR']."','".$tbc."')";
    mysql_query($query);
    print '<font color="green" size="2"><b>Account created successfuly!</b></font>';
    }
    else
    {
    IF ($loginlen = 0 or $passwordlen = 0 or $emaillen = 0 or $retypelen = 0)
    {
    print '<font color="red" size="2"><b>Please fill in all the fields! One or more fields are not filled...</b></font>';
    };
    };
    };
    $result = mysql_query("SELECT * FROM accounts");
    $num_rows = mysql_num_rows($result);
    print "<br><br><font color='red' size='2'><b><i>There are curently <font size='3' color='blue'>- $num_rows -</font> registered accounts in the server database .\n</i></b></font>";

    ?>


    i know its messy, but the mysql select statement is the key

  4. #4
    Sorcerer Supreme grandmst20 is offline
    Member +Rank
    Feb 2007 Join Date
    427Posts

    Re: [Help] SQL multiple database select statement

    I'll look around.

    If I'm thinking right, if you have one character DB, the person can make a character on the fun server and get 10K gold, then login on the Blizzlike server and still retain everything. That's the main problem. Care to test to confirm it?

  5. #5
    Member irishboy777 is offline
    MemberRank
    Aug 2007 Join Date
    coloradoLocation
    69Posts

    Re: [Help] SQL multiple database select statement

    confirmed, i think its the characters between two realms, with one account, so im thinking two seperate account databases, that way i can run two realms, with two character databases

  6. #6
    Member irishboy777 is offline
    MemberRank
    Aug 2007 Join Date
    coloradoLocation
    69Posts

    Re: [Help] SQL multiple database select statement

    bump...i tried changing the statements, but nothin works, any ideas?

    Edit: any luck grandmst20?
    Last edited by irishboy777; 07-12-07 at 05:51 AM.

  7. #7
    Member irishboy777 is offline
    MemberRank
    Aug 2007 Join Date
    coloradoLocation
    69Posts

    Re: [Help] SQL multiple database select statement

    bump...hows bout the first person who answers this will get....70 levels on my server, sound fair?
    and its gotta work, or help in some way
    thanks much



Advertisement