This is the fact: I'm building a homepage that can access a mysql database, and display the records within a certain condition. Following this it is verified if the sql result was empty then it should write a certain frase, if not it should write the records. I've got the worst part ok, the while that display the results, but the if isn't being verified, it writes the frase anyway. Please help, the code is right under the file name:
indicador.php <? include "db_dados.php"; ?> <? $sql = "SELECT * FROM tb_tao WHERE area='$area'and status=1"; $res = @mysql_query($sql,$id) ?> <? echo "<table width='100%' height='100%' border='0' align='center'>" ?> <? echo "<tr><td><div align='center'>Nenhum profissional cadastrado.</div></td></tr>"; ?> <? while ($row = mysql_fetch_array($res)) { ?> <? echo"<tr><td>ID Profissional</td>"; echo"<td>".$row['id']."</td></tr>"; echo"<tr><td>Nome</td>"; echo"<td>".$row['nome']."</td></tr>"; echo"<tr><td>Profissão</td>"; echo"<td>".$row['area']."</td></tr>"; echo"<tr><td>Bairro</td>"; echo"<td>".$row['bairro']."</td></tr>"; echo"<tr><td>Telefone</td>"; echo"<td>".$row['telefone']."</td></tr>"; echo"<tr><td>E-mail</td>"; echo"<td>".$row['email']."</td></tr>"; echo"<tr><td>Telefone Celular</td>"; echo"<td>".$row['celular']."</td></tr>"; echo"<tr><td>Registro Profissional</td>"; echo"<td>".$row['regprof']."</td></tr>"; echo"<tr><td>Endereço</td>"; echo"<td>".$row['endereco']."</td></tr>"; echo"<tr><td> </td>"; echo"<td> </td></tr>"; ?> <? } ?> <? echo"</table>"; ?> db_dados.php <? $id = mysql_connect("localhost","rodrigo","g3mston3")or die ('I cannot connect to the database.'); $con = mysql_select_db("db_tao"); ?>