i need a very small help

Discussion in 'PHP' started by baris22, Sep 20, 2010.

  1. #1
    hello,

    can you please show me how to display $mypricetag after $row['price']

    
    echo "<td align=\"center\">&nbsp;".($row['price'] > 0.00?" $mypricetag ".$row['price']:"-")."</td>";
    
    PHP:

     
    baris22, Sep 20, 2010 IP
  2. axelay

    axelay Peon

    Messages:
    54
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    echo "<td align=\"center\">&nbsp;" . (($row['price'] > 0.00) ? $mypricetag . $row['price'] : "-") . "</td>";

    Hope that helps ;)

    aXe
     
    axelay, Sep 21, 2010 IP
  3. ashishkg

    ashishkg Active Member

    Messages:
    233
    Likes Received:
    8
    Best Answers:
    3
    Trophy Points:
    68
    #3
    echo "<td align=\"center\">&nbsp;".($row['price'] > 0.00?" . $mypricetag ".$row['price']:"-")."</td>";

    this help you
     
    ashishkg, Sep 21, 2010 IP
  4. baris22

    baris22 Active Member

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #4
    At the moment my output is:

    £ 2.00

    i want to change this into

    2.00 £

    $mypricetag is the currency sembol (£$...)
     
    baris22, Sep 21, 2010 IP
  5. axelay

    axelay Peon

    Messages:
    54
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    echo "<td align=\"center\">&nbsp;" . (($row['price'] > 0.00) ? $row['price'] . $mypricetag : "-") . "</td>";
    Will do the trick ;)

    aXe
     
    axelay, Sep 21, 2010 IP
    baris22 likes this.
  6. baris22

    baris22 Active Member

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #6
    thanks alot. it worked kind of but it made changes on my design. it added another <td> when there is no price for that field.
     
    baris22, Sep 21, 2010 IP
  7. baris22

    baris22 Active Member

    Messages:
    543
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    60
    #7
    ok. sorted now.

    thanks alot
     
    baris22, Sep 21, 2010 IP