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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.