if to show button or text

0
    <?php

echo '


<table border=1>
<tr>
<th>ID Pergunta</th>
<th>Pergunta</th>
<th>Responder</th>
</tr>
'
;
include ("ligabd.php");//CONECTAR A BD
$sql="SELECT * from pedido WHERE ID_pr=".$_SESSION['ID'];
$sql1="SELECT * from resposta";

$resultado = mysql_query($sql);
while ($sql = mysql_fetch_array($resultado)) {

    echo '
    <tr>
    <td><form method="post" action="resposta.php" class="login">
    <input type="text" name="pergunta_id" id="pergunta_id" value= ' ;?> <?php echo $sql['ID']; ?> <?php echo ' > </td>
    <td>'.$sql['pergunta'].'</td>
    <td>  ';
    if (!isset($sql1['resposta'])!=""){
echo '<button type="submit" class="login-button">Responder</button>
</td>
</tr>';
}
else echo 'Pergunta Respondida';
}
    echo '</table>';
?>

Hello, I have a question in this code, I want if to show me a button if the answer record is clear. For example, I have a question like the following image:

Ifitwasalreadyanswered,"Answered Question" appeared, and if it was not answered, the

    
asked by anonymous 01.05.2016 / 12:12

1 answer

0

Replace the isset with empty:

if (empty($sql1['resposta'])){
//mostra botão
}else{
//pergunta respondida
}
    
01.05.2016 / 17:45