Can someone please tell me what I am doing wrong. When executed it displays a list starting with the second record and skips the first. Thanks in advance!
Armando
if(is_array($prodoptions)){
print "<table border='0' cellspacing='1' cellpadding='1' width='100%'>";
$rowcounter=0;
foreach($prodoptions as $rowcounter => $theopt){
$index=0;
$gotSelection=FALSE;
$cacheThis=! $useStockManagement;
while($index < (maxprodopts-1) && ((int)($aOption[0][$index])!=0)){
if($aOption[0][$index]==(int)($theopt["poOptionGroup"])){
$gotSelection=TRUE;
break;
}
$index++;
}
if(!$gotSelection){
$aOption[2][$index]=false;
$sSQL="SELECT optID,optName,optGrpName," . $OWSP . "optPriceDiff,optType,optFlags,optStock,optPriceDiff AS optDims FROM options LEFT JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE optGroup=" . $theopt["poOptionGroup"] . " ORDER BY optID LIMIT 0, 1000";
$result = mysql_query($sSQL) or print(mysql_error());
if($rs2=mysql_fetch_array($result)){
if(abs((int)$rs2["optType"])==3){
$aOption[2][$index]=true;
$fieldHeight = round(((double)($rs2["optDims"])-(int)($rs2["optDims"]))*100.0);
$aOption[1][$index] = "<tr><td align='right' width='30%'>" . $rs2["optGrpName"] . ":</td><td> <input type='hidden' name='optnPLACEHOLDER' value='" . $rs2["optID"] . "'>";
if($fieldHeight != 1){
$aOption[1][$index] .= "<textarea wrap='virtual' name='voptnPLACEHOLDER' cols='" . atb((int)($rs2["optDims"])) . "' rows='$fieldHeight'>";
$aOption[1][$index] .= $rs2["optName"] . "</textarea>";
}else
$aOption[1][$index] .= "<input maxlength='255' type='text' name='voptnPLACEHOLDER' size='" . atb($rs2["optDims"]) . "' value=\"" . str_replace('"',""",$rs2["optName"]) . "\">";
$aOption[1][$index] .= "</td></tr>";
}else{
$num_results = mysql_num_rows($result);
$aOption[1][$index] = "<tr><td align='left' width='30%'>" . $rs2["optGrpName"].':'. '<br>Number of finishes available: '.$num_results.'<br>';
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
echo $row['optName'].'<br>'."</td></tr>";
}