Simple varible wont work!

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Simple varible wont work!

    Hey heres the code:

    <? if (xbt = 1) { ?>
    <tr><Td colspan=2><center>The STATS are from the
    XBT tracker we run as the backend of the
    server.</center></td></tr>

    <? } else {?>
    <? } ?>

    and the varible is:

    xbt = 0;

    The varible is at the top of the file.

    Why wont this work? If set one 1 or 0 it displays the
    <tr><Td colspan=2><center>The STATS are from the
    XBT tracker we run as the backend of the
    server.</center></td></tr>

    Please help.




    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    Devboy Guest

  2. Similar Questions and Discussions

    1. Wont Work
      Every time I go to Youtube or photobucket yo watch something, it says you need at least flash player 8 or whatever. And I click the link that takes...
    2. SQL wont work
      Can anyone suggest why this SQL wont work? Someone has suggested that I have a few " in the wrong place. I am missing the basic understanding...
    3. ASP PAGES WONT WORK
      We have a 2000 server running IIS 5.0. and it seems that no asp pages are working. it gives an error server application error. please help.
    4. Can anyone tell me why this wont work
      Dear Stephen on stopMovie repeat with n in the windowlist -- forget n -- use this forget the windowlist end repeat end
    5. Can anyone tell me why this wont work??
      I am trying to check and see if a field is posted or not, if not posted then assign $location which is a session variable to $location_other. If...
  3. #2

    Default Re: Simple varible wont work&#33;

    $xbt = 1 is an assignment...
    use if($xbt==1) instead

    ROD


    "Devboy" <devil@e-xtreme-dot-net.no-spam.invalid> wrote in message
    news:EtednalTp7Zctw3dRVn_vA@giganews.com...
    > Hey heres the code:
    >
    > <? if (xbt = 1) { ?>
    > <tr><Td colspan=2><center>The STATS are from the
    > XBT tracker we run as the backend of the
    > server.</center></td></tr>
    >
    > <? } else {?>
    > <? } ?>
    >
    > and the varible is:
    >
    > xbt = 0;
    >
    > The varible is at the top of the file.
    >
    > Why wont this work? If set one 1 or 0 it displays the
    > <tr><Td colspan=2><center>The STATS are from the
    > XBT tracker we run as the backend of the
    > server.</center></td></tr>
    >
    > Please help.
    >
    >
    >
    >
    > ----------------------------------------
    > The post originated from PHP Freaks:
    > ----------------------------------------
    > [url]http://www.phpfreaks.com[/url]
    > [url]http://www.phpfreaks.com/forums[/url]
    >
    >

    Rod Guest

  4. #3

    Default Re: Simple varible wont work&#33;

    Tried that, when i do that it wont display even is its set to 0 or 1
    :S



    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    Devboy Guest

  5. #4

    Default Re: Simple varible wont work&#33;

    --------

    <?php
    xbt = 1; // change value to test xbt =0 or whatever
    ?>

    yadda yadda in html

    <?php
    if (xbt == 1) {
    ?>
    <tr><Td colspan=2><center>The
    STATS are from the XBT tracker we run as the backend of the
    server.</center></td></tr>
    <?php
    } // end case of xbt equals one

    else {
    ?>
    boo hoo
    <?php
    }
    ?>
    --------

    Easier to read like this.

    The answer is

    [url]http://www.php.net/manual/en/index.php[/url]

    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    AndyB Guest

  6. #5

    Default Re: Simple varible wont work&#33;

    No doesnt seem to work with the code layout i have or something,
    because with the varible at the top of the page under the

    <?

    But with the varible under tyhe code u made under:

    <?php
    xbt = 1;

    if (xbt == 1;)

    etc etc then it works fine :S.



    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    Devboy Guest

  7. #6

    Default Re: Simple varible wont work&#33;

    > No doesnt seem to work with the code layout i have or something
    ... but with the varible under tyhe code u made ... it works fine :S.
    >
    >
    Then I assume there's something not right with the code layout you
    have.

    The only difference between <? and <?php is that <? assumes
    'short tags' are enabled (which they usually are). Safest is
    always to use <?php to begin a chunk of php script.

    So, have we solved your problem??

    The answer is

    [url]http://www.php.net/manual/en/index.php[/url]

    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    AndyB Guest

  8. #7

    Default Re: Simple varible wont work&#33;

    Well that code works so in away yes, but the function wont work, so in
    a way no :S.



    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    Devboy Guest

  9. #8

    Default Re: Simple varible wont work&#33;

    > Well that code works so in away yes, but the function wont work, so
    in a way no :S.
    >
    >
    ... what function?? I don't see any mention of a function in your
    posts (or am I in need of more sleep/more coffee?).

    The answer is

    [url]http://www.php.net/manual/en/index.php[/url]

    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    AndyB Guest

  10. #9

    Default Re: Simple varible wont work&#33;

    Sorry! i ment varible, wotn work with my code layout.



    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    Devboy Guest

  11. #10

    Default Re: Simple varible wont work&#33;

    > Sorry! i ment varible, wotn work with my code layout.
    >
    >
    Then my inevitable conclusion is that your 'layout' is wrongly
    coded. If you want help with fixing it ... post a useful chunk of
    the code you have and use the CODE button in your response to show
    your code in the most readable format.

    The answer is

    [url]http://www.php.net/manual/en/index.php[/url]

    ----------------------------------------
    The post originated from PHP Freaks:
    ----------------------------------------
    [url]http://www.phpfreaks.com[/url]
    [url]http://www.phpfreaks.com/forums[/url]


    AndyB Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139