I put it in this form sence i changed my issure and topic.
Ok can anyone tell me how to fix this : after i do a count, i want to take the results and update the colum count.
if the count finds three groups then only those three groups get the count added and the others stay at zero
I am stuck if anyone can help me, i have changed things so much that this seems like the best way now if i can get the category counts to stay at zero that are not listed in subcat.
Not sure if i am saying this right !!
I want it to count all and group it, then update all in colum count in table category. This way i will always have a true count of how many links in each category.
$query3 = "SELECT categoryg, count(*) as `count` FROM subcat GROUP BY categoryg";
$result3 = mysql_query($query3) or die( "ERROR: " . mysql_error() . "\n");
while($row = mysql_fetch_array($result3)) {
$catcount = $row['count'];
print($catcount);
}
$query4 = "UPDATE category SET count='$catcount' WHERE category='$categoryg'";
$result4 = mysql_query($query4) or die( "ERROR: " . mysql_error() . "\n");
//query4 is my issue, query3 works fine. query4 updates the count for the groups that are counted but i need the other category counts to stay at zero
}