If statement

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Rosaka
Forum Newbie
Posts: 13
Joined: Mon Jan 10, 2011 2:00 pm

If statement

Post 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.
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: If statement

Post 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 ?>.
Post Reply