Sorry if that Subject is confusing... ???
I have a products with a list of "labels" the table contains the producst_id, label_id, and label_value. This table was set up poorly. There are 61 labels, but some products don't have all 61 values. If there is no value, there is no table row.
I need to list all 61 values for each product, with "smurm" in place of any missing values.
I'm sure there is an easier way, but why doesn't the following work? I thought the count would fill in the blanks with smurm, but it just skips them:
while($products = tep_db_fetch_array($products_query)) {
$dagoods = $products['products_id'];
echo "{$product_id}\t";
$i = 1;
while ($i <= 61){
$query = tep_db_query("SELECT label_id, label_value FROM label_product_label WHERE products_id='$product_id' AND label_id = '$i' ORDER BY label_id LIMIT 1");
$num_rows = mysql_num_rows($query);
while ($row = tep_db_fetch_array($query)) {
$label_guts = stripslashes($row['label_value']);
if ($num_rows = 1){
echo "{$label_guts}\t";
}
else { echo "smurm\t"; }
}
$i++;
}
echo "\n";
}
?>