i am making a code for a php game of mine, but i am not sure how to loop?
[code] $chance = rand(1,2);
if ($chance == 1){
$page .= “
You hammer the “.$itemsrow[‘name’].” bars in a beautiful “.$itemsrow2[‘name’].””;
$insertquery = doquery(“INSERT INTO {{table}} SET id=’’,userid=’”.$userrow[“id”]."’,itemnum=’$makeitem’,equipped=‘0’", “inventory”);
for ($counter=0;$$counter<=$amount;$counter+=1){
$invquery = doquery(“SELECT * FROM {{table}} WHERE userid=’$yourid’ AND itemnum=’$itemnum’”, “inventory”);
$invrow = mysql_fetch_array($invquery);
$updatequery = doquery(“DELETE FROM {{table}} WHERE id=’”.$invrow[‘id’]."’", “inventory”);}
}
[/code]
I am trying to delete the number of rows that is listed in $amount.
in this case $amount = 3
but for some reason this makes amount = to infinity. i just took that loop code off another site because i dont know anything about them.
if someone could please help me that would be great.
if you need additional code/information it will be provided