makexitxcount Posted July 26, 2006 Share Posted July 26, 2006 i´m trying to hide the values "NomTecnic" and the text "see" when "EstatTecnic" is different from A, but i just can do it with the "NomTecnic" value, does somebody knows how to make "see" to not show up when the value "EstatTecnic" is different from A. Thanks<?php do { ?> <tr> <td><?php if($row_rstTecnic['EstatTecnic']=="A"){ echo $row_rstTecnic['NomTecnic'];} ?></td> <td> <a href="tecnic.php?tecnic=<?php echo $row_rstTecnic['NumTecnic']; ?>">see</a></td> </tr> <?php } while ($row_rstTecnic = mysql_fetch_assoc($rstTecnic)); ?> </table> Quote Link to comment Share on other sites More sharing options...
ozPATT Posted July 26, 2006 Share Posted July 26, 2006 not sure i understand entirely what you want to do... do you mean you ONLY want the link to show if "A" is present? The following code will only display the link if EstatTecnic is equal to "A".[code]<?php //build and run query $sql = "SELECT * FROM ..."; $result = mysql_query($sql); //is something wrong? if(!$result) { echo mysql_error(); } //count results $count = mysql_num_rows($result); //if no results, tell user, if results, display. if($count == 0) { $display = ('<p>There are no results.</p>'); //modify error message to be what you want. } else { //build array to pull data from db while($row = mysql_fetch_array) { //set vars $EstatTecnic = $row['NumTecnic']; } //build table, only display link if EstatTecnic is equal to "A" $display = ('<table><tr><td>'); if($EstatTecnic == "A") { $display .= ('<a href="tecnic.php?tecnic=' . $EstatTecnic . '" title="see" target="_self">see</a>'); } $display .= ('</td></tr></table>'); } //echo everything echo($display);?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.