I have got data from mysql_fetch_assoc stored in to an array using this command
if(mysql_num_rows($data) > 1){
while($row = mysql_fetch_assoc($data)){
$ndata[] = $row;
}
} else {
$ndata = mysql_fetch_assoc($data);
}
Now when I use count on $ndata
, it retuns 1; although it is empty.
When I run mysql_num_rows on the returned data it retuns 0 rows. But when I convert the data to $ndata and then run count on that it returns 1. I want it to return the number of rows.
Thanks
Can someone please explain why is there a problem and how to fix it?