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 11
  1. #1
    Join Date
    Nov 2006
    Location
    Liverpool/Manchester
    Posts
    2,457
    Tokens
    0

    Latest Awards:

    Default Code help please

    Hey,

    I need help with this code please

    PHP Code:
    else
    {

    $id $mybb->user["uid"];
    $news strip_tags($_POST["news"]);
    $games strip_tags($_POST["games"]);
    $vids strip_tags($_POST["vids"]);
    $imgs strip_tags($_POST["imgs"]);
    $favs strip_tags($_POST["favs"]);
    $forum strip_tags($_POST["forum"]);
    $stats strip_tags($_POST["stats"]);
    $notes strip_tags($_POST["notes"]);

    $dbh mysql_connect ("localhost""user""pass") or die
    (
    "I cannot connect to the database because: " mysql_error());
    mysql_select_db ("database");

    [
    THIS LINE]    mysql_query("INSERT INTO `database`.`table` (`users_homepage_id`, `users_homepage_news`, `users_homepage_games`, `users_homepage_vids`, `users_homepage_imgs`, `users_homepage_favs`, `users_homepage_forum`, `users_homepage_notes`, `users_homepage_stats`) VALUES('$id','$news','$games','$vids','$imgs','$favs','$forum','$stats','notes')") or die(mysql_error()); [END OF LINE]
        echo 
    "<span style=\"background-color: yellow\">\"Sbumitted</span>";

            } 
    The line with [THIS LINE] is giving the error below (Obviously [THIS LINE] and [END OF LINE] arn't on the actual page :p

    Parse error: syntax error, unexpected T_VARIABLE
    Anyone got any ideas why :S I can't work it out

    Thanks in advance

    Joe
    Last edited by iJoe; 18-12-2009 at 07:10 PM.
    Joe


  2. #2
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default

    which line does the error respond to?

  3. #3
    Join Date
    Nov 2006
    Location
    Liverpool/Manchester
    Posts
    2,457
    Tokens
    0

    Latest Awards:

    Default

    This one is giving the error

    PHP Code:
        mysql_query("INSERT INTO `database`.`table` (`users_homepage_id`, `users_homepage_news`, `users_homepage_games`, `users_homepage_vids`, `users_homepage_imgs`, `users_homepage_favs`, `users_homepage_forum`, `users_homepage_notes`, `users_homepage_stats`) VALUES('$id','$news','$games','$vids','$imgs','$favs','$forum','$stats','notes')") or die(mysql_error()); 
    </span></span>
    Joe


  4. #4
    Join Date
    Sep 2009
    Location
    Hull
    Posts
    827
    Tokens
    0

    Latest Awards:

    Default

    Looking at the code, correct me if Im wrong but shouldnt it be this...

    mysql_query("INSERT INTO `database`,`table` (`users_homepage_id`, `users_homepage_news`, `users_homepage_games`, `users_homepage_vids`, `users_homepage_imgs`, `users_homepage_favs`, `users_homepage_forum`, `users_homepage_notes`, `users_homepage_stats`) VALUES('$id','$news','$games','$vids','$imgs','$fa vs','$forum','$stats','notes')") or die(mysql_error());
    Lew.
    Im not here to be loved, I love to be hated :-}


  5. #5
    Join Date
    Nov 2006
    Location
    Liverpool/Manchester
    Posts
    2,457
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Lewiie15 View Post
    Looking at the code, correct me if Im wrong but shouldnt it be this...



    Lew.
    What have you changed :s I put it in though it's still not working

    Joe
    Joe


  6. #6
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Shoved that in my IDE, and it had no errors. The code you supplied I cant see anything that would make that error appear, post all of the code (at least the whole if statement).
    Hi, names James. I am a web developer.

  7. #7
    Join Date
    Sep 2009
    Location
    Hull
    Posts
    827
    Tokens
    0

    Latest Awards:

    Default

    Well I cant see anything wrong with that code or anything that would cause that error...

    All I can suggest is, rewriting the code...

    Lew.
    Im not here to be loved, I love to be hated :-}


  8. #8
    Join Date
    Nov 2006
    Location
    Liverpool/Manchester
    Posts
    2,457
    Tokens
    0

    Latest Awards:

    Default

    Here's the whole code on that page

    PHP Code:
    <?php require_once('config.php'); ?>


    <?php

    if($mybb->user['uid'])
    {
       
    // logged in

    echo "Hello! As part of the new Nexdana you can change what you see when you're logged into Nexdana. Simply tick the checkbox if you do want it on your homepage, untick it if you don't!";

    echo 
    '<SCRIPT>

    function enableField(form,input)
    {
        var formname = form;
        var formfield = input;
    document.contactform.o_subject.disabled=false;
    document.contactform.subject.disabled=true;
    document.getElementById("o_subject").style.display = "inherit";
    document.getElementById("subject").style.display = "none";

    }


    </SCRIPT>
    <form action="" enctype="multipart/form-data" method="post" name="homepage">
    <label>Site News: <input name="news" type="checkbox" value="1"></label><br /> 
    <label>Latest Games: <input name="games" type="checkbox" value="1"></label><br />
    <label>Latest Videos: <input name="vids" type="checkbox" value="1"></label><br />
    <label>Latest Images: <input name="imgs" type="checkbox" value="1"></label><br /> 
    <label>Your favourites: <input name="favs" type="checkbox" value="1"></label><br />
    <label>Latest forum posts: <input name="forum" type="checkbox" value="1"></label><br />
    <label>Stats box: <input name="stats" type="checkbox" value="1"></label><br />
    <label>Your notes: <input name="notes" type="checkbox" value="1"></label><br />
     <br />
     
     <input type="submit" value="save" name="submit"/></form>
    <br />
    </font></div><div class="right-bot"></div>
    </div>'
    ;


    }
    else
    {
      
    //logged out
    echo "You must be logged in to change your homepage settings. Please login then come back";
    }

    ?>

    <?php



    $id 
    $mybb->user["uid"];
    $news strip_tags($_POST["news"]);
    $games strip_tags($_POST["games"]);
    $vids strip_tags($_POST["vids"]);
    $imgs strip_tags($_POST["imgs"]);
    $favs strip_tags($_POST["favs"]);
    $forum strip_tags($_POST["forum"]);
    $stats strip_tags($_POST["stats"]);
    $notes strip_tags($_POST["notes"]);

    $dbh mysql_connect ("localhost""user""pass") or die
    (
    "I cannot connect to the database because: " mysql_error());
    mysql_select_db ("db");

        
    mysql_query("INSERT INTO 'db','tbl' (`users_homepage_id`, `users_homepage_news`, `users_homepage_games`, `users_homepage_vids`, `users_homepage_imgs`, `users_homepage_favs`, `users_homepage_forum`, `users_homepage_notes`, `users_homepage_stats`) VALUES('$id','$news','$games','$vids','$imgs','$favs','$forum','$stats','notes')") or die(mysql_error()); 
        echo 
    "<span style=\"background-color: yellow\">\"Your settings are now saved</span>";

            
    unset(
    $_POST);
    ?>
    The error is still

    Parse error: syntax error, unexpected T_VARIABLE in settings.php on line 71
    and the line is

    PHP Code:
    mysql_query("INSERT INTO 'db','tbl' (`users_homepage_id`, `users_homepage_news`, `users_homepage_games`, `users_homepage_vids`, `users_homepage_imgs`, `users_homepage_favs`, `users_homepage_forum`, `users_homepage_notes`, `users_homepage_stats`) VALUES('$id','$news','$games','$vids','$imgs','$favs','$forum','$stats','notes')") or die(mysql_error()); 
    Joe
    Joe


  9. #9
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Again, nothing "wrong" with the syntax there either. Are you sure the page you are looking on is 'settings.php' ? If it isnt, the line of error is on the settings page.
    Hi, names James. I am a web developer.

  10. #10
    Join Date
    Nov 2006
    Location
    Liverpool/Manchester
    Posts
    2,457
    Tokens
    0

    Latest Awards:

    Default

    Yep, definitely pasting the settings page there and getting the error on that page
    Joe


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
  •