-5
<?php
include("conectar.php");
$quantidade = 1;
$pagina = (isset($_GET ['pagina'])) ? (int) $_GET['pagina'] : 1;
$inicio = ($quantidade * $pagina) - $quantidade;
$where = "";
$estado = '' . @$_POST['estado'];
$distrito = '' . @$_POST['distrito'];
$concelho = '' . @$_POST['concelho'];
switch ([$estado, $distrito, $concelho]) {
    Case ['Indiferente', 'Indiferente', 'Indiferente']:
        break;
    case ['Indiferente', 'Aveiro', 'Indiferete']:
        $where = "WHERE tb_trabalhador.Distrito = 'Aveiro' ";
        break;
    case ['Indiferente', 'Aveiro', 'Agueda']:
        $where = "WHERE tb_trabalhador.distrito = 'Aveiro' AND tb_trabalhador.concelho = 'Agueda'";
        break;
}
//Aqui tenho a dúvida pois nem sempre quero utilizar $SQL. Se for ['autorizado','Indiferente','Indiferente'] Já tem uma query diferente. Como posso fazer essa distinção? 
$sql = "select * from tb_detalhe_trabalhador inner join tb_trabalhador on tb_detalhe_trabalhador.id = tb_trabalhador.id inner join tb_equipamentos on tb_detalhe_trabalhador.id = tb_equipamentos.id $where order by tb_trabalhador.id asc LIMIT $inicio, $quantidade";
$qr = mysql_query($sql) or die(mysql_error());
while ($exibe = mysql_fetch_array($qr)) {
    echo "<table>";
    echo "<tr><td>Nome:</td>";
    echo "<td>" . $exibe["Nome"] . "</td></tr>";
    echo "</table>";
}
$sqltotal = "SELECT id FROM tb_trabalhador $where";
$qrtotal = mysql_query($sqltotal) or die(mysql_error());
$numtotal = mysql_num_rows($qrtotal);
$totalpagina = ceil($numtotal / $quantidade);
echo '<a href="?pagina=1">Primeira página</a>';
for ($i = 1; $i <= $totalpagina; $i++) {
    if ($i == $pagina)
        echo $i;
    else
        echo"<a href=\"?pagina=$i\">$i</a>";
}
echo '<a href="?pagina=$totalpagina">Ultima Pagina</a>';
?>
						
Could you post the whole code? or are you sure it’s in this snippet that’s giving the problem??
– Tafarel Chicotti
The problem is in this line $qr = mysql_query($sql) or die(mysql_error()); or after using any case gives me the problem.
– ChrisAdler
Is any case giving error? Variables
$sqland$qrexist outside the cases?– Tafarel Chicotti
line before While. Any case gives the same error
– ChrisAdler
Before the
switchtrialvar $sql, $qr;– Tafarel Chicotti
With var before Switch not even show me page only error..
– ChrisAdler