cjkeane Posted April 11, 2011 Share Posted April 11, 2011 hi everyone. i need to figure out how to display one tr or another based on if N/A appears in one of the TR's. if i use: 'if ($result['NoChargeFile'] = 'N/A')' it repeats N/A for all rows. if i use: 'if ($result['NoChargeFile'] = N/A)' only the TotalFees TR is displays. What i need to do is display the TOTALFEES if the NOCHARGEFILE is not N/A. If NOCHARGEFILE is N/A, display N/A instead of the TOTALFEES. Any ideas how to fix this issue? thanks. <?php echo "<table width='100%' border='0' cellpadding='1'>"; $string = $string."$pages->limit"; $query = mysql_query($string) or die (mysql_error()); $result = mysql_fetch_array($query); if($result==true) { do { echo "<tr>"; echo '<td nowrap>' . $result['CompanyName'] . '</td>'; echo '<td nowrap>' . $result['CompanyReferenceNumber'] . '</td>'; if ($result['NoChargeFile'] = 'N/A') { echo '<td nowrap>' . $result['NoChargeFile'] . '</td>'; } else { echo '<td nowrap>' . $result['TotalFees'] . '</td>'; } echo '<td nowrap>' . $result['DateRecorded'] . '</td>'; echo '<td nowrap>' . $result['DateClosed'] . '</td>'; echo "</tr>"; } while($result = mysql_fetch_array($query)); } // close table> echo "</table><hr>"; ?> I figured it out. i need == not =. Link to comment https://forums.phpfreaks.com/topic/233314-php-hide-tr-based-on-value-in-another-tr/ Share on other sites More sharing options...
dcro2 Posted April 11, 2011 Share Posted April 11, 2011 The correct syntax for checking if something is equal is with two equal signs. f ($result['NoChargeFile'] == 'N/A') Link to comment https://forums.phpfreaks.com/topic/233314-php-hide-tr-based-on-value-in-another-tr/#findComment-1199865 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.