• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

php Error little help please

308holes

New Member
Hello im getting an error on this script and i dont know why can anyone help

Parse error: parse error, unexpected T_IF on line 12
PHP:
<?php
   $bgColor
    if($bgColor != "FFFFFF" or $bgColor != "8f9599" or $bgColor != "ABB0B3")
	/*if($bgColor == "")*/
    {
	  bgColor = "8f9599"
    }
   else
    {
	  bgColor = "FFFFFF"
     <!--// Do Nothing Yet //-->
    {
?>
 
i think it should be like this

PHP:
<?php
   $bgColor
    if($bgColor != "FFFFFF" or $bgColor != "8f9599" or $bgColor != "ABB0B3")
    /*if($bgColor == "")*/
    {
      bgColor = "8f9599"
    }
   else
    {
      bgColor = "FFFFFF"
     <!--// Do Nothing Yet //-->
    }
?>

just having the } around the wrong way can course this i belive
 
Last edited:
Re:

Nope still
PHP:
<?php
   $bgColor
    if($bgColor != "FFFFFF" || $bgColor != "8f9599" || $bgColor != "ABB0B3")
    {
	  $bgColor = "8f9599"
    }
   else
    {
	  $bgColor = "FFFFFF"
    }
?>
 
Last edited:
their has to be something wrong with the "if" no matter what i keep getting that error on line 12 and thats the start of the "if"
 
PHP:
<?php 
   $bgColor 
    if($bgColor != "FFFFFF" || $bgColor != "8f9599" || $bgColor != "ABB0B3") 
    { 
      $bgColor = "8f9599"; 
    } 
   else 
    { 
      $bgColor = "FFFFFF"; 
    } 
?>
Don't forget ;'s...
 
Im still getting the same error's i have tryied

PHP:
<?php
   $bgColor
    if($bgColor != "FFFFFF" || $bgColor != "8f9599" || $bgColor != "ABB0B3")
    {
      $bgColor = "8f9599";
    }
   else
    {
      $bgColor = "FFFFFF";
    }
?>

and
PHP:
<?php
   $bgColor
    if($bgColor != "FFFFFF" or $bgColor != "8f9599" or $bgColor != "ABB0B3")
    {
      $bgColor = "8f9599";
    }
   else
    {
      $bgColor = "FFFFFF";
    }
?>
 
[ph]
<?php
$bgColor = "";
if($bgColor != "FFFFFF" or $bgColor != "8f9599" or $bgColor != "ABB0B3")
/*if($bgColor == "")*/
{
bgColor = "8f9599"
}
else
{
bgColor = "FFFFFF"
<!--// Do Nothing Yet //-->
}
?>
[/php]

This is basic PHP. $bgcolor didn't equal anything, and there was no terminator..

Because of this, the if statement was not expected, it was expecting a declaration and a terminator. Nothing wrong with the if statement.

Regards,
 
Back
Top