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!


Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default Query running script =]

    Heres the query;

    PHP Code:
    INSERT INTO `script_settings` (`settingName`, `settingValue`, `settingLastUpdate`, `settingUpdatedBy`) VALUES ('script_version''1.0''$date $time''OurHabbo Systems'
    Heres the page its running from;

    PHP Code:
    if(!$_POST["submit"]){
    echo 
    "<form method=POST>
    SQL:<br>
    <textarea name='sql' rows='10' cols='50'></textarea><br><br>
    <input type='submit' name='submit' value='Run Query'>
    </form>"
    ;
    }else{
    $sql $_POST[sql];
    $query mysql_query($sql) or die(mysql_error());
    if(
    $query){ echo "Query successfully ran"; }else{ echo "There was a problem running the query"; }

    (Yes its connected to the database)
    & heres the error;

    PHP Code:
    You have an error in your SQL syntaxcheck the manual that corresponds to your MySQL server version for the right syntax to use near '\'script_version\', \'1.0\', \'$date $time\', \'OurHabbo Systems\')' at line 1 
    Any reason why its not working?
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  2. #2
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    It has slashes in it, thats weird?

    You use ` and ' too much to my liking.

    PHP Code:
    <?php

    if (!$_POST["submit"]) {
        echo 
    "<form method=POST>
    SQL:<br>
    <textarea name='sql' rows='10' cols='50'></textarea><br><br>
    <input type='submit' name='submit' value='Run Query'>
    </form>"
    ;
    } else {
        
    $sql $_POST["sql"];
        
    $sql stripslashes($sql);
        
    $query mysql_query($sql) or die(mysql_error());
        if (
    $query) {
            echo 
    "Query successfully ran";
        } else {
            echo 
    "There was a problem running the query";
        }
    }

    ?>

  3. #3
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    haha whoops my bad... didnt even think of it =]
    Ty
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  4. #4
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Depending on your server settings it usually adds slashes to (')'s

    so \'hey\' just like when you put " inside of a " declaration in PHP.

    So you must first strip those, if you want it to be executed properly.

  5. #5
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    Oki, heres another prob...

    Using forms.. I put this into database
    PHP Code:
    <li><a href="$site_domain">Home</a></li
    Now, retrieving from database....
    PHP Code:
        <?
        $nav 
    mysql_fetch_array(mysql_query("SELECT * FROM `script_templates` WHERE `templateID` = '3'"));
        
    $templateHTMLstripslashes($nav[templateHTML]);
        echo 
    "$templateHTML";
        
    ?>
    How do i stop it from echoing $site_domain.... but the variable for $site_domain that i have defined previously???
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  6. #6
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    unset($site_domain);
    Right before that

  7. #7
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    right before....?
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  8. #8
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Right before the whole query.

  9. #9
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default

    PHP Code:
    <? 
    unset($site_domain);
        
    $nav mysql_fetch_array(mysql_query("SELECT * FROM `script_templates` WHERE `templateID` = '3'")); 
        
    $templateHTMLstripslashes($nav[templateHTML]); 
        echo 
    "$templateHTML"
        
    ?>
    Still returns a URL link of http://$site_domain/ instead of what $site_domain is set as... yourdomain.com
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  10. #10
    Join Date
    May 2007
    Location
    Nebo, NC, USA
    Posts
    2,517
    Tokens
    0

    Latest Awards:

    Default

    Oh, well you can't just pull the HTML out and expect it to parse it as PHP variables..
    PHP Code:
    <?
    $nav 
    mysql_fetch_array(mysql_query("SELECT * FROM `script_templates` WHERE `templateID` = '3'"));
    $templateHTML stripslashes($nav[templateHTML]);
    $templateHTML str_replace("{site_domain}"$site_domain$templateHTML);
    echo 
    $templateHTML;
    ?>

Page 1 of 2 12 LastLast

Posting Permissions

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