Re: If statement duplicating mysql records?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Pruim wrote:
> 
> 
> The code I had worked out, originally was something along the lines of:
> 
> if($row[5] =="Level1") (
> echo "<TR><TD bgcolor=".$Level1.">$row[0] </td>";
>     echo "<td bgcolor=".$Level1.">$row[1]  </td>";
>     echo "<td bgcolor=".$Level1."><A href='$row[2]'>Instructions</A></td>";
>     echo "<TD bgcolor=".$Level1."><A
> href='update.php?taskid=$row[0]'>Click here!</A>";
> }
> 
> if($row[5] =="Level2"){
>     echo "<TR><TD bgcolor=".$Level2.">$row[0] </td>";
>     echo "<td bgcolor=".$Level2.">$row[1]  </td>";
>     echo "<td bgcolor=".$Level2."><A href='$row[2]'>Instructions</A></td>";
>     echo "<TD bgcolor=".$Level2."><A
> href='update.php?taskid=$row[0]'>Click here!</A>";
> 
> {
> else
> {
> echo "<TR><TD bgcolor=".$unclassified.">$row[0] </td>";
>     echo "<td bgcolor=".$unclassified.">$row[1]  </td>";
>     echo "<td bgcolor=".$unclassified."><A
> href='$row[2]'>Instructions</A></td>";
>     echo "<TD bgcolor=".$unclassified."><A
> href='update.php?taskid=$row[0]'>Click here!</A>";
> 
> }
> 
> and what would happen is if $row[5] =="Level1" it would change the color
> to yellow, but then it would also display another line of the same info
> that would have the $unclassified color assigned to it.

Ahh, this is different from your original post. You have TWO if
statements here. So when $row[5] = "Level1", it was satisfying the first
IF statement and then falling into the ELSE of the second IF statement.

Makes sense to me now why it was failing.

Roberto

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux