Code: Select all
$token = strtok($string,"|");
while($token)
{
$count = ($count + 1);
$accessories = mysql_query ("SELECT * FROM products WHERE id = '$token'");
while ($accslist = mysql_fetch_object($accessories))
{ echo "
<input type='hidden' name='X"; echo $count; echo "include' value='on'>
<input type='hidden' name='X"; echo $count; echo "storeid' value='44175'>
<input type='checkbox' name='X"; echo $count; echo "itemcode' value='$accslist->code'>";
}
$token = strtok("|");
}But each time it always starts at 2, and when I read it it's obvious why. Because $count is a maths sum.
How do I set it so $count starts at 1, and on the second loop it goes up by one each time?
I know it will be simple, but this is just foxxing me for hours.