Simple varible wont work!

This is a discussion on Simple varible wont work&#33; 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>...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-28-2004
Devboy
 
Posts: n/a
Default Simple varible wont work&#33;

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


Reply With Quote
  #2 (permalink)  
Old 04-28-2004
Rod
 
Posts: n/a
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:
> ----------------------------------------
> http://www.phpfreaks.com
> http://www.phpfreaks.com/forums
>
>



Reply With Quote
  #3 (permalink)  
Old 04-28-2004
Devboy
 
Posts: n/a
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:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


Reply With Quote
  #4 (permalink)  
Old 04-29-2004
AndyB
 
Posts: n/a
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

http://www.php.net/manual/en/index.php

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


Reply With Quote
  #5 (permalink)  
Old 04-29-2004
Devboy
 
Posts: n/a
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:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


Reply With Quote
  #6 (permalink)  
Old 04-29-2004
AndyB
 
Posts: n/a
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

http://www.php.net/manual/en/index.php

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


Reply With Quote
  #7 (permalink)  
Old 04-29-2004
Devboy
 
Posts: n/a
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:
----------------------------------------
http://www.phpfreaks.com
http://www.phpfreaks.com/forums


Reply With Quote
  #8 (permalink)  
Old 04-29-2004
AndyB
 
Posts: n/a
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

http://www.php.net/manual/en/index.php

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


Reply With Quote
  #9 (permalink)  
Old 04-29-2004
Devboy
 
Posts: n/a
Default Re: Simple varible wont work&#33;

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


Reply With Quote
  #10 (permalink)  
Old 04-29-2004
AndyB
 
Posts: n/a
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

http://www.php.net/manual/en/index.php

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


Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:52 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0