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