Help with in_array
Posted: Wed Oct 10, 2007 12:17 pm
I have the following result in an array:
and i am trying to find if some value exits using the in_array function but can get it to run properly:
Why is this not working?
Code: Select all
Array ( [0] => Array ( [x_list_id] => 14 [client_id] => 6[list_id] => 36 [x_list_name] => Chocolate [x_list_option] => choice [x_list_price] => 0 [x_list_status] => active [x_list_added] => 2007-10-09 17:20:35 ) [1] => Array ( [x_list_id] => 17 [client_id] => 6[list_id] => 36 [x_list_name] => Cookies and Cream [x_list_option] => choice [x_list_price] => 0 [x_list_status] => active [x_list_added] => 2007-10-09 17:21:17 ) [2] => Array ( [x_list_id] => 13 [client_id] => 6[list_id] => 36 [x_list_name] => Haagen-Dazs [x_list_option] => choice [x_list_price] => 0 [x_list_status] => active [x_list_added] => 2007-10-09 17:20:22 ) [3] => Array ( [x_list_id] => 16 [client_id] => 6[list_id] => 36 [x_list_name] => Strawberry [x_list_option] => choice [x_list_price] => 0 [x_list_status] => active [x_list_added] => 2007-10-09 17:21:03 ) [4] => Array ( [x_list_id] => 15 [client_id] => 6[list_id] => 36 [x_list_name] => Vanilla [x_list_option] => choice [x_list_price] => 0 [x_list_status] => active [x_list_added] => 2007-10-09 00:00:00 ) )Code: Select all
if(in_array("choice",$rows)){ $choice = "true";}if(in_array("standard",$rows)){ $standard = "true";}if(in_array("extra",$rows)){ $extra = "true";}