Okay guys, mysql_num_rows() is acting really strange, when ever i call it in my loop, it doesn't allow me to display other records that i need to come up.
For instance I'm checking to see if a category has a subcategory but it isn't showing the categories that don't have subcategories.
Here's the code:
$sub_cats = mysql_query("SELECT * FROM `categories` WHERE sub = '". $result['name'] ."'");
while($row = mysql_fetch_array($sub_cats))
{
$query = mysql_query("SELECT * FROM `categories` WHERE sub = '". $row['name'] ."'");
$rows_count = mysql_num_rows($query) or die(mysql_error());
if($rows_count > 0)
{
echo "<div class=\"category\" onclick=\"getCategories('". $row['name'] ."'); return false;\">". $rows_count ." ". UCWords($row['name']) ."</div>";
}
else
{
//Just to check if it would even show the rows without sub-categories.
echo "DSAKFKASDSA";
}
}
Anyone have any idea's why this is happening, or is this just some dumb mistake i'm making because it's been awhile since i've used PHP.
-Zack