Re: If statement duplicating mysql records?
| From: | Jason Pruim | Date: | Thu, 21 Jun 2007 17:50:27 +0000 |
| Subject: | Re: If statement duplicating mysql records? | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-257574@lists.php.net to get a copy of this message | ||
On Jun 21, 2007, at 1:42 PM, Roberto Mansfield wrote:
Jason Pruim wrote:It's not quite making sense to me though... My understanding of IF statements is if the condition is met it ignores all the other if's. Is that not correct? At this point it's just me trying to figure things out for my knowledge :)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>";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'echo "<td bgcolor=".$Level1.">$row[1] </td>"; echo "<td bgcolor=".$Level1."><A href='$row[2]'>Instructions</A></td>"; echo "<TD bgcolor=".$Level1."><Ahref='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."><Ahref='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."><Ahref='$row[2]'>Instructions</A></td>";echo "<TD bgcolor=".$unclassified."><Ahref='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.
--PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php