Please help me understand how to append the results into the following variable $getAllCategory as dinstinct items when going through thise loop:
$CategoriesArray = array(“Womens”,“Mens”,“Childrens”);
$CategoriesCount = count($CategoriesArray);
$sqlAllCategory = “”;
$getAllCategory = “”;
while($k < $CategoriesCount)
{
$sqlAllCategory = “SELECT DISTINCT mydb FROM table1 WHERE (category1 = '”.$CategoriesArray[$k]."’ or category2 = ‘".$CategoriesArray[$k]."’ or category3 = ‘".$CategoriesArray[$k]."’ or category4 = ‘".$CategoriesArray[$k]."’) ORDER BY shirt;";
$k++;
}
$getAllCategory = @mysql_query($sqlAllCategory) or die(mysql_error());
$num3 = mysql_num_rows($getAllCategory);
if(mysql_num_rows($getAllCategory) > 0)
{
$h=0;
while ($row = mysql_fetch_array($getAllCategory))
{
$h++;
echo '"',$row['shirt'];
if ($h<$num3) { echo '",'; }
else{ echo '"'; }
}
}
//I appreciate the help very much