Jump to content

How to make this work???


makexitxcount

Recommended Posts

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>
Link to comment
https://forums.phpfreaks.com/topic/15674-how-to-make-this-work/
Share on other sites

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]
Link to comment
https://forums.phpfreaks.com/topic/15674-how-to-make-this-work/#findComment-63932
Share on other sites

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.