Hi All:
I am attempting to write a code for a dynamic select box. That isn't the problem. The problem is, I want to omit any option that has a flag in it from appearing in the select options. No matter what I am doing, options that should be ommitted are still appearing in the select. I believe the problem is with
if ($rowBlock["promoter"] == $rowPromoters["promoter"]){
$vBlockedPromoter = 1;
No matter what I try, $vBlockedPromoter never equals 1. I even tried hard coding using a record that should absolutely be omitted but still no luck.
Here is the complete code:
<?php
$queryPromoters = "
SELECT
promoter
FROM
promoters
WHERE
ratingList = 'Y'
ORDER BY
promoter
";
$resultPromoters = mysqli_query($link, $queryPromoters);
$queryBlock = "
SELECT
DISTINCT promoter
FROM
ratings
WHERE
ratingDate >= DATE_SUB(CURDATE(), INTERVAL 90 DAY) AND
username = '".$slusername."'
";
$resultBlock = mysqli_query($link, $queryBlock);
$vBlockCount = mysqli_num_rows($resultBlock);
if (mysqli_num_rows($resultBlock)===0) {
while($rowPromoters = mysqli_fetch_array($resultPromoters, MYSQLI_ASSOC)){
echo "<option>".$rowPromoters["promoter"]."</option>\r\n";
} // Close while($rowPromoters = mysqli_fetch_array($resultPromoters, MYSQLI_ASSOC)){
} else {
while($rowPromoters = mysqli_fetch_array($resultPromoters, MYSQLI_ASSOC)){
while($rowBlock = mysqli_fetch_array($resultBlock, MYSQLI_ASSOC)){
if ($rowBlock["promoter"] == $rowPromoters["promoter"]){
//if ($rowPromoters["promoter"] == "Mike Jones, LLC"){
$vBlockedPromoter = 1;
}
} // Close while($rowBlock = mysqli_fetch_array($resultPromoters, MYSQLI_ASSOC)){
if ($vBlockedPromoter != 1){
echo "<option>".$rowPromoters["promoter"]." ".$vBlockedPromoter."</option>\r\n";
$vBlockedPromoter = 0;
} //Close if ($vBlockedPromoter != 1){
}
mysqli_free_result($resultBlock);
} // Close while($rowPromoters = mysqli_fetch_array($resultPromoters, MYSQLI_ASSOC)){ {
mysqli_free_result($resultPromoters);
echo "</select>";
?>