I have a problem with mysql_fetch_array. I'm trying to do this:
if(count(mysql_fetch_array(mysql_query($peticion)))) {
array_push($errores, $texto['conta_existe']);
}
The previous code should detect if mysql_fetch_array found a row in my database and, if it found at least one, an array should be pushed. Problem is that if I haven't got anything in my db, fetch_array returns the number "1".
I tried to find what's happening with this peace of code:
$arrayc = mysql_fetch_array(mysql_query($peticion), MYSQL_NUM);
echo 'PRINT_R: ';
echo print_r($arrayc);
echo '<br>COUNT: ';
echo count($arrayc);
And returns this:
PRINT_R: Array ( [0] => FLEREX [conta] => FLEREX ) 1
COUNT: 2
I don't understand why there's that number one there, after the array. The previous quote was returned with only one row, to show you the array; but if there's not any row in the db, this is what I get:
PRINT_R: 1
COUNT: 1
I don't know where comes from that one, but is always there.
Thanks for reading and sorry for my bad english.