0
There is a query in my PHP where you search the email list and return to PHP, however, it is not returning any results.
The PHP Code looks like this:
<?php
session_start("admin");
if($_SESSION["admin"] == "on"){
include("../config.php");
?>
<?php
$sql = mysql_query("SELECT `email` FROM `n_emails` WHERE 1");
$resultado = mysql_query($sql) or die(mysql_error());
while($lista2=mysql_fetch_array($resultado)) {
$email = $lista2["email"];
$ativo = $lista2["ativo"];
if($ativo=="n"){
$ativo = "<font face='Arial' size='2' color='red'>Não confirmado</font>";
}
else{
$ativo = "<font face='Arial' size='2' color='green'>Confirmado</font>";
}
?>
<tr>
<td width="50%">
<p align="center"><b><font face="Arial" size="2"><?=$email?></font> </b></td>
<td width="25%"><?=$ativo?></td>
<td width="25%"><a href="javascript:remove('<?=$email?>')">
<font face="Arial" size="2">remover</font></a></td>
</tr><?php } ?>
<?php
}
else{
echo "<script>location.href='login.php'</script>";
}
?>
When I run this query manually, it returns all the correct results. I don’t understand what is happening.
Enter the most complete code. The problem is not in the query.
– Filipe Moraes
@Filipemoraes Basically that’s it
– João Victor Gomes Moreira
You are selecting wrong. Delete this WHERE 1.
– denis
solved, just change the query, thanks Denis and Filipe
– João Victor Gomes Moreira