This is a discussion on Simple varible wont work! within the alt.comp.lang.php forums, part of the PHP Programming Forums category; Hey heres the code: <? if (xbt = 1) { ?> <tr><Td colspan=2><center>...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums |
|
|||
|
$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: > ---------------------------------------- > http://www.phpfreaks.com > http://www.phpfreaks.com/forums > > |
|
|||
|
Tried that, when i do that it wont display even is its set to 0 or 1
:S ---------------------------------------- The post originated from PHP Freaks: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums |
|
|||
|
--------
<?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 http://www.php.net/manual/en/index.php ---------------------------------------- The post originated from PHP Freaks: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums |
|
|||
|
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: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums |
|
|||
|
> 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 http://www.php.net/manual/en/index.php ---------------------------------------- The post originated from PHP Freaks: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums |
|
|||
|
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: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums |
|
|||
|
> 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 http://www.php.net/manual/en/index.php ---------------------------------------- The post originated from PHP Freaks: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums |
|
|||
|
Sorry! i ment varible, wotn work with my code layout.
---------------------------------------- The post originated from PHP Freaks: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums |
|
|||
|
> 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 http://www.php.net/manual/en/index.php ---------------------------------------- The post originated from PHP Freaks: ---------------------------------------- http://www.phpfreaks.com http://www.phpfreaks.com/forums |
![]() |
| Thread Tools | |
| Display Modes | |
|
|