Jump to content

help with if statements in a while loop?


spiritwalker
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...