Page 1 of 1

If statement

Posted: Mon Jan 17, 2011 1:17 pm
by Rosaka
My if statement does not seem to be working.

http://pastebin.com/498TNs7v

anyone see a problem? its just printing all items not just xbox ones.

Re: If statement

Posted: Mon Jan 17, 2011 1:34 pm
by greyhoundcode
pastebin.com wrote:

Code: Select all

<?php if ( $game->getConsole() == "xbox" )  ?>
      {
            <tr>
            <td >
                <?php echo "<img src=".$game->getImg().">"; ?>
            </td>
                <td>
                <a href="desc.php?id=<?php echo $game->getID(); ?>
                   &name=<?php echo $game->getName(); ?>"><?php echo $game->getName();?></a>
                </td>
            <td>
                <?php echo $game->getDate(); ?>
            </td>
            <td>
                <?php echo $game->getPrice(); ?>
            </td>
            <td>
               <a href="cart.php?id=<?php echo $game->getID(); ?>">Add to cart</a>
            </td>
        </tr>
       }
1. It isn't possible to tell what is happening within the $game->GetConsole() method from your Paste Bin code alone.

2. Following your If statement in the above extract you have a curly brace, however it is not within PHP tags <?php ?>.