function retornaStatusPesquisa($numeroStatus,$nomePessoa, $nomeTabela){
$query = mysql_query("SELECT COUNT(status) AS valorStatus FROM $nomeTabela WHERE status=$numeroStatus AND nomePessoa='$nomePessoa'");
$contador=mysql_fetch_assoc($query);
return $contador;
}
I'm getting this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE status = 1 AND namePerson =' Joao '' at line 1
It's probably because of $nomeTabela
, I do not know for what reasons this happens, could you give a light?