Jump to content

php: hide tr based on value in another tr.


cjkeane

Recommended Posts

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 =.

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.