This is it at the moment. It's going thru the loop, but it's still counting up from 1 at the bottom, when it shouldn't be.
The system now should be showing an "in stock" product for 1, out of stock for 2 (so NOT counting up), in stock for 3, and out of stock for 4 (so NOT counting up).
It's to show tick boxes on a product page when the product code shows it's in stock.
If I put the "++" code after this: $titletick cost shown in checkout</div></div>";
ie.
Code: Select all
$titletick cost shown in checkout</div></div>"; $romancount ++;
It throws a fit, and gives me a million 222222222222222222222222222 on the screen.
If I ask it to echo <font color='#ff0000'>$romancount</font> at the bottom, I get a 'yes' even if I shouldn't. I did spot that the previous "yes" will be remembered, so I set it to NULL at the end, but then that products the 222222222222222222222222222.
So am a little lost.
Your questions of why am I doing certain ways? Answer: because that'sthe method what I know.
Code: Select all
if ($row->titletick1 != NULL)
{
echo "<br/><font style='font-size: 12px'>";
if ($row->catid == "507") { $color = "#009900";} else { $color = "#ff5500";}
$romancount = 1;
while ($romancount <= 12)
{
if ($row->{'romancodetick' . $romancount} != NULL)
{
$romancodetick = $row->{'romancodetick' . $romancount};
$titletick = $row->{'titletick' . $romancount};
$resultrccheck = mysql_query ("SELECT rcstock FROM products WHERE romancode = '$romancodetick' AND rcstock = 'in stock'");
$num_rcstock = mysql_num_rows($resultrccheck);
if ($num_rcstock == 1)
{
$romanstockcheck = "yes";
$xinclude = "X".$romancount."include";
$xitemcode = "X".$romancount."itemcode";
echo "<div><input type='checkbox' name='$xinclude' value='on' onclick=\"showMe('div$romancount', this)\">
Include $titletick $romanstockcheck<font color='#009900'>$romancount</font>
<input type='hidden' name='$xitemcode' value='$romancodetick'>
<div class='row' id='div$romancount' style='display:none; font-size: 11.2px; color: $color'>
$titletick cost shown in checkout</div></div>";
}
}
if ($romanstockcheck == "yes")
{ $romancount ++; }
echo "<font color='#ff0000'>$romancount</font>";
}
echo "</font>";
}