Switch Statement Issue?

Discussion in 'PHP' started by mokimofiki, Oct 15, 2009.

  1. #1
    Can anyone tell me what I'm doing wrong with this switch statement? The $ is in the database as text. Either $, $$, $$$, $$$$.




    switch ($_row['price'])
             {
             case $:
                echo "<\$15";
                    break;
             case $$:
                echo "<\$20";
                    break;
             case $$$:
                    echo "<\$25";
                    break;
             case $$$$:
                    echo ">\$25";
                    break;
             default:
                    echo "No Average Specified";
             }
    Code (markup):
     
    mokimofiki, Oct 15, 2009 IP
  2. mokimofiki

    mokimofiki Well-Known Member

    Messages:
    444
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #2
    Nevermind stupid mistake I had $_row instead of $row .... duh (it was a post variable and I changed it forgetting to remove the _)
     
    mokimofiki, Oct 15, 2009 IP