Jump to content

help with if statements in a while loop?


spiritwalker

Recommended Posts

Hi, I am new here and fairly new to php, i am currently trying to manipulate data from a mysql data table but i am struggling a little with some syntax. Basically i am tabulating data on a web page with php from mysql but i want to apply different styles from css if certain fields are within certain values. I am struggling with gettting an if statement to work within a while loop which populates the table. I would be grateful if someone could point me in the right direction. Heres a snippet of my code but its not liking the syntax it seems to be within the if statement as when its not there it works fine. Thanks in advance while($row=mysql_fetch_array($result)){ echo "</td><td>"; echo $row['testid']; echo "</td><td>"; echo $row['sampleid']; echo "</td><td>"; echo $row['testcode']; echo "</td><td>"; echo $row['testdesc']; echo "</td><td>"; echo $row['receptiondate']; echo "</td><td>"; echo $row['enddate']; echo "</td>"; if ( $row['expiry'] < 24 ) { echo "<td class="data">$row['expiry']</td>"; } else { echo echo "<td>"$row['expiry']; } echo "</td></tr>";}echo "</table>";

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...