211655 Posted May 18, 2004 Posted May 18, 2004 whats wrong here. i want to find out that if any of them is greater than 10 if (($cartProducts[0]['weight']) > 10 II ($cartProducts[1]['weight']) > 10 II ($cartProducts[2]['weight']) > 10 ) { i need: if weight[0] > 10 or weight[1] > 10 or..... 211655 SEO Optimization Export Orders into CSV file
detsouvalas Posted May 18, 2004 Posted May 18, 2004 Maybe if (($cartProducts[0]['weight'] > 10 ) | ($cartProducts[1]['weight'] > 10 ) ?| ($cartProducts[2]['weight'] > 10 )) { ? Antonios
sirblack Posted May 19, 2004 Posted May 19, 2004 I've always used double vertical bars to represent 'or' ( || ), is there a difference between the single one and the double one? I never even though to try if the single one works.
211655 Posted May 19, 2004 Author Posted May 19, 2004 single worked for me, btw, how do u type them. is it capital L or capital I ? 211655 SEO Optimization Export Orders into CSV file
sirblack Posted May 19, 2004 Posted May 19, 2004 It's actually the bar above the "backslash" ( \ ) on your keyboard. Also: if weight[0] > 10 or weight[1] > 10 or..... how many products are you checking? are you looking to evaluate the weight of every product in your cart? if you are, writing a bunch of "or" operators won't do your script much justice. It would be more practical to do a while/for/foreach loop around everything that evaluates a variable like $i to the size of the $cartProducts array, then your if statement would look something like this: if ($cartProducts[$i]['weight'] >10) { .... }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.