Php if statement help

Hello,
I would like to know if this be possible,
This is what i have so far. i have the string that i got from for loop and keep in the var. Example: in var when i echo i what 1,2,3,4,5 and so on
So, here i what i would like to run, if anytime if i have “1” in the var
i would like to run this {condition}
else
{this condition}.

Hope this make sense.

This is just shopping cart that i try to make change.

for loop use to grab as “category id”
if anytime category id == 1 is present in the cart
i would like to run the above statement.

As of now, i would not able to do it. If var = 1 and var =2 in the cart.
Statement skip the “if” and run the “else”.

Any advice.

Hi sshhll,

i think this might help you. If you would have posted your code then it would have been easy to solve as LSC-Rob said.


$sql=mysql_query("QUERY");
if(mysql_num_rows($sql)){
  while($rs=mysql_fetch_array($sql)){
   if($rs['categoryid']==1){
     //do your condition
  }else{
    //do else
  }
  }
}else{
 echo "no records found";
}

Is it possible for you to post the code that’s giving you grief?