Outputting anchor class in PHP While() loop seems inconsistent

AmiraL

New Member
I have two fields in a SQL table, \[code\]done\[/code\] and \[code\]current\[/code\]. Both have data that is either 1 (yes) or 0 (false). Within my \[code\]while()\[/code\] PHP loop that creates my elements, I have the following code:\[code\]$current=mysql_result($result,$i,"current");$done=mysql_result($result,$i,"done");if ($done == 1){$doneorcurrent = "done";} if($current == "1"){$doneorcurrent = "current";}else {$doneorcurrent = "";}\[/code\]Then I call \[code\]$doneorcurrent\[/code\] using the following:\[code\]<a class="article <? echo $doneorcurrent ?>"</a>\[/code\]The problem is that even though one of my \[code\]done\[/code\] fields has a 1, it never shows up. I've dinked around with the code for a while now, and once I made it so it was the reverse - only \[code\]done\[/code\] showed up, and not \[code\]current\[/code\].Is there a better way I should be doing this? See http://www.bavarianblue.com/to-do-list/ for an example. The titles of each task are wrapped in a class that should contain \[code\]current\[/code\] or \[code\]done\[/code\]. As you can see, the rest of the data outputs correctly in the \[code\]While()\[/code\] loop, so it doesn't seem like that is wrong.
 
Back
Top