Jump to content


Photo

Parse error


  • Please log in to reply
2 replies to this topic

#1 jeds

jeds
  • Members
  • PipPip
  • Member
  • 14 posts
  • LocationCentral NYS Finger Lakes

Posted 30 April 2006 - 02:10 AM

I think its a script, nomenclature overwhelms me:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
<?php
if ($_SERVER['SERVER_ADDR'] = 216.40.250.54) {
?>
<strong>BLUE</strong>
<?php
} else {
?>
<strong>YELLOW</strong>
<?php
}
?>
[/quote]

I just get the Parse error

Thx
Its not whether the code works, but if you are persistent enough to get the code to work.

#2 LiLaaron

LiLaaron
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 30 April 2006 - 03:30 AM

Hi,

<?php

if ($_SERVER['SERVER_ADDR'] == "216.40.250.54") {
    echo "<strong>Not Found</strong>";
} else {
    echo "<strong>We Got It!</strong>";
}

?>

That should do it

Aaron

#3 jeds

jeds
  • Members
  • PipPip
  • Member
  • 14 posts
  • LocationCentral NYS Finger Lakes

Posted 30 April 2006 - 03:50 PM

Thanks, Aaron, it works great. So now I can use it to define variables:
<?php

if ($_SERVER['SERVER_ADDR'] == "216.40.250.54") {
$var = 'Bob';
$var_2 = 'Sam';
} else {
$var = 'Ralph';
$var_2 = 'Joe';
}

?>


<?php
echo "$var, $var_2";
?>

Works too :)
Its not whether the code works, but if you are persistent enough to get the code to work.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users