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 16
  1. #1
    Join Date
    Dec 2005
    Location
    Mank-Chest-Hair
    Posts
    4,039
    Tokens
    2,266

    Latest Awards:

    Default Quick PHP Question

    I wanna have something like this on my page

    PHP Code:
    <?php

    $rangeba4 
    'value'
    $rangeb80x60 ''
    $rangeb20x30 ''
    $rangeb20x24 ''
    $rangeb70x50 ''
    $rangeb18x24 ''
    $rangeba2 ''
    $rangeb16x20 ''
    $rangeb18x24 ''
    $rangeba20x8 ''
    $rangeba16x12 ''
    $rangeba3 ''
    $rangeb14x11 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''

    ?>
    But all the variables will be different and theres going to be like 100 in total. If I then fetch it all over the page, will it slow the website down / crash anyones browser?

  2. #2
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    1,111
    Tokens
    100

    Latest Awards:

    Default

    Quote Originally Posted by ksoz View Post
    I wanna have something like this on my page

    PHP Code:
    <?php

    $rangeba4 
    'value'
    $rangeb80x60 ''
    $rangeb20x30 ''
    $rangeb20x24 ''
    $rangeb70x50 ''
    $rangeb18x24 ''
    $rangeba2 ''
    $rangeb16x20 ''
    $rangeb18x24 ''
    $rangeba20x8 ''
    $rangeba16x12 ''
    $rangeba3 ''
    $rangeb14x11 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''

    ?>
    But all the variables will be different and theres going to be like 100 in total. If I then fetch it all over the page, will it slow the website down / crash anyones browser?
    Lol, it takes alot to crash a browser... I crashed mine when I accidently coded my PHP to loop

    But anyway, you are asking "If I use the code here, will it slow my website down?" as apposed to ?

  3. #3
    Join Date
    Dec 2005
    Location
    Mank-Chest-Hair
    Posts
    4,039
    Tokens
    2,266

    Latest Awards:

    Default

    I mean will it affect the speed of the site because I will need to fetch the variables alot all over the page.

    I am new to PHP you see.

  4. #4
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    1,111
    Tokens
    100

    Latest Awards:

    Default

    When you say you need to fetch alot of variables over the page, I assume you are talking about getting them from the database...

    Just setting the variables like you have done in the sample code will not slow it down.

    If you were literally just doing like

    PHP Code:
    $variable 'text'
    etc. and then echoing each variable, it would slow it down a bit but it wouldn't be significantly slower.. It won't be noticeable really..

    It's hard for me to tell. What information are you fetching? and are you going to be echoing/printing it.

  5. #5
    Join Date
    Dec 2005
    Location
    Mank-Chest-Hair
    Posts
    4,039
    Tokens
    2,266

    Latest Awards:

    Default

    Thanks for trying to help, I explained it to someone on MSN and they helped me out +rep for your help.

  6. #6
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    1,111
    Tokens
    100

    Latest Awards:

    Default

    Quote Originally Posted by ksoz View Post
    Thanks for trying to help, I explained it to someone on MSN and they helped me out +rep for your help.
    Ha, I didn't manage to help. Sorry for not understanding what you want to do Too early haha.

  7. #7
    Join Date
    Dec 2005
    Location
    Mank-Chest-Hair
    Posts
    4,039
    Tokens
    2,266

    Latest Awards:

    Default

    I wasnt being clear so its not your fault.

    What I meant was having this on top of my page

    PHP Code:
    <?php

    $rangeba4 
    'value'
    $rangeb80x60 ''
    $rangeb20x30 ''
    $rangeb20x24 ''
    $rangeb70x50 ''
    $rangeb18x24 ''
    $rangeba2 ''
    $rangeb16x20 ''
    $rangeb18x24 ''
    $rangeba20x8 ''
    $rangeba16x12 ''
    $rangeba3 ''
    $rangeb14x11 ''
    $rangeb12x12 ''
    $rangeb12x10 ''
    $rangeb10x10 ''
    $rangeb10x8 ''
    $rangeb9x7 ''
    $rangeb8x6 ''
    $rangeb7x5 ''
    $rangeb6x4 ''
    $rangeb5x4 ''
    $rangeb5x3half ''
    $rangeb3halfx3half ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''
    $rangeba4 ''

    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="EN"><head>
    and using this code all over the page

    PHP Code:
    <?= $rangeba4 ?>

  8. #8
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    1,111
    Tokens
    100

    Latest Awards:

    Default

    oh okay. Surely it would be easier, instead of defining a variable as whatever. Just echo the whatever rather than the variable that u defined as whatever.

    lol

  9. #9
    Join Date
    Dec 2005
    Location
    Mank-Chest-Hair
    Posts
    4,039
    Tokens
    2,266

    Latest Awards:

    Default

    Sorry that just confused me. I am new to PHP, like my day 1, didnt understand a word up there.
    <?= $rangeba4 ?> - isnt that just getting the data from the top of the page?
    And echo? :S

  10. #10
    Join Date
    Apr 2009
    Location
    United Kingdom
    Posts
    1,111
    Tokens
    100

    Latest Awards:

    Default

    Quote Originally Posted by ksoz View Post
    Sorry that just confused me. I am new to PHP, like my day 1, didnt understand a word up there.
    <?= $rangeba4 ?> - isnt that just getting the data from the top of the page?
    And echo? :S
    echo is where u display it.

    Basically you want to do this:

    PHP Code:
    <?php

    $vairableOne 
    'Value';
    $variableTwo 'Value';
    $variableThree 'Value';

    ?>
    then some html blardy

    HTML Code:
    <html>
    <div>
    <?php echo $variableOne; ?>
    Right, echo means like DISPLAY. So that's display $variableOne.

    Surely it would be easier to not set the varaibles ($variableOne etc.).

    and just echo the values out in the html.

    <?php echo 'Value'; ?>

    This would work if you were putting the values in yourself. However, if you are fetching the results from a database then it'd be different.

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
  •