no aspetta un momento...Originariamente inviato da marcopa
Ci sto sbattendo la testa, so che è la query sbagliata, ma non riesco a vedere l'errore!.
la query è giusta.
se nel db hai
TIPO_CAMPO
calcio
basket
tennis
calcio
la
select tipo_campo, count(*) from tba group by tipo_campo
ti restituisce:
calcio 2
basket 1
tennis 1
quindi l'errore sarà o nel database,
oppure nel id_reg che gli passi nella where
fai così dopo la query metti
echo $query e vedi quel è la select fatta effetivamente e se è quella che avevi in mente