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: HELP PHP Stuck!

  1. #1
    Join Date
    Apr 2011
    Posts
    30
    Tokens
    50

    Default HELP PHP Stuck!

    Right so this is my code -
    <?php echo '- <a class="red_link" href="irl/viewProfile.php?id=' . $_SESSION['id'] . '">My Profile</a>'; ?>

    This is what I want it to look like -
    <?php echo '- <a class="red_link" href="javascript:ajaxpage('irl/viewProfile.php?id=' . $_SESSION['id'] . ', 'mid');'">My Profile</a>'; ?>

    This is the error -
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in lala/the/url/was/here on line 38

    Many Thanks!
    ResourceHabbo comming soon

  2. #2
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    4,753
    Tokens
    1,860
    Habbo
    ,Alpha,

    Latest Awards:

    Default

    Instead of using $_SESSION['id'] all the time it's easier to put it into a variable.

    PHP Code:
    $id $_SESSION['id'
    I have no idea what's gone wrong in your echo sorry

  3. #3
    Join Date
    Oct 2011
    Location
    Melbourne
    Posts
    637
    Tokens
    1,376

    Default

    Quote Originally Posted by MetroMint View Post
    Right so this is my code -
    <?php echo '- <a class="red_link" href="irl/viewProfile.php?id=' . $_SESSION['id'] . '">My Profile</a>'; ?>

    This is what I want it to look like -
    <?php echo '- <a class="red_link" href="javascript:ajaxpage('irl/viewProfile.php?id=' . $_SESSION['id'] . ', 'mid');'">My Profile</a>'; ?>

    This is the error -
    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in lala/the/url/was/here on line 38

    Many Thanks!
    You need to escape the ' marks on ajaxpage( ?

  4. #4
    Join Date
    Apr 2011
    Posts
    30
    Tokens
    50

    Default

    Quote Originally Posted by Lee View Post
    Instead of using $_SESSION['id'] all the time it's easier to put it into a variable.

    PHP Code:
    $id $_SESSION['id'
    I have no idea what's gone wrong in your echo sorry
    Yeah thats the only one
    Quote Originally Posted by Blinger View Post
    You need to escape the ' marks on ajaxpage( ?
    Yeah I do that I just missed the code as I typed it out on here not copied
    ResourceHabbo comming soon

  5. #5
    Join Date
    Apr 2011
    Posts
    30
    Tokens
    50

    Default

    Fixed mod close please!
    ResourceHabbo comming soon

  6. #6
    Join Date
    Jul 2006
    Location
    Cambridge, UK
    Posts
    447
    Tokens
    0

    Latest Awards:

    Default

    Why don't you just echo the session ID instead of it all?

    Code:
    <a class="red_link" href="javascript:ajaxpage('irl/viewProfile.php?id=<?php echo $_SESSION['id'];?>, 'mid')">My Profile</a>
    If that isn't suitable, then it appears you've got a ; and ' (marked red) that you don't need.

    Code:
    <?php echo '- <a class="red_link" href="javascript:ajaxpage(\'irl/viewProfile.php?id=' . $_SESSION[\'id'] . ', \'mid\');'">My Profile</a>'; ?>
    Last edited by Jonster; 08-04-2012 at 09:44 PM.

  7. #7
    Join Date
    Apr 2012
    Posts
    6
    Tokens
    0

    Default

    Try this

    Code:
    <?php echo '- <a class="red_link" href="javascript:ajaxpage(\'irl/viewProfile.php?id=' . $_SESSION[id] . '\', \'mid\');">My Profile</a>'; ?>
    Last edited by tyr0ne; 09-04-2012 at 04:03 PM.

Posting Permissions

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