Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 7 of 7

Thread: Mysql query

  1. #1
    Join Date
    Feb 2006
    Location
    /usr/local
    Posts
    2,809
    Tokens
    688

    Latest Awards:

    Default Mysql query

    Ive got The habbo soft free user system and i want to edit all tables at once to add mass credits. (or even a mass creds php script. although i could make one if i knew the query)
    Also how can i change it so when they sign up they get 100 free creds?

  2. #2
    Join Date
    Dec 2007
    Posts
    174
    Tokens
    100

    Default

    On the register page, once the data the user imputed is entered in to the database, update the credits column where the row is equal to the username they registered with.

    Good luck.
    Last edited by sgraham; 29-02-2008 at 05:40 PM.
    Best regards,

    Scott Graham
    “When you have confidence, you can have a lot of fun. And when you have fun, you can do amazing things.”

  3. #3
    Join Date
    Jul 2005
    Posts
    1,653
    Tokens
    50

    Latest Awards:

    Default

    UPDATE `table` SET `credits` = '100' [WHERE `id` = '1']

    [] = optional, that just sets it for people you want to set it, but the first bit will update all credits in the table.

  4. #4
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    change the default value of the credits col in the usr_users database to 100 and theyll auto get 100 when they register.

    As for giving everyone 100
    Try the following php script

    PHP Code:
    <?php
    require("config.php");
    $g1 mysql_query("select * from usr_users");
    while(
    $cr mysql_fetch_array($g1))
    {
    $newbal $cr[credits] + 100;
    mysql_query("update usr_users set credits = '$newbal' where id = '$cr[id]'");
    }
    echo(
    "100 Credits have been added to all users.");
    ?>
    Coming and going...
    Highers are getting the better of me

  5. #5
    Join Date
    Jul 2005
    Posts
    1,653
    Tokens
    50

    Latest Awards:

    Default

    Whats the point in the while statement and the $g1 line?

  6. #6
    Join Date
    May 2006
    Posts
    1,797
    Tokens
    0

    Latest Awards:

    Default

    $g1 gets the info from db
    the while adds 100 creds to every user in the database and updates individually.
    Coming and going...
    Highers are getting the better of me

  7. #7
    Join Date
    Jul 2005
    Posts
    1,653
    Tokens
    50

    Latest Awards:

    Default

    I'd do:
    update `usr_users` set `credits` = `credits` + 100

    Not sure if that will work, but you can do something alone them lines, saves having to get all the info form the db.

Posting Permissions

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