RE: [PHP] Array Question

From: Date: Tue, 26 Mar 2002 18:07:32 +0000
Subject: RE: [PHP] Array Question
Groups: php.general 
Request: Send a blank email to php-general+get-90236@lists.php.net to get a copy of this message
$n =sizeof($state); $srch = ""; while( $x=0; $x<$n; $x++) { ... do something with array element $state[$x] ... $srch .= $state[$x].", "; } $srch = rtrim($srch,", "); $query = "SELECT * FROM mytable WHERE t_state_id_state in ($srch)"; -----Original Message----- From: John Fishworld [mailto:john@webital.de] Sent: Tuesday, March 26, 2002 11:51 AM To: php-general@lists.php.net Subject: [PHP] Array Question I have some multiple select boxes in a form ie <SELECT name="state[]" multiple size=5 style="width:360;"> <option value="all">all Regions </option> <option value="16">Region19 </option> <option value="14">Region14</option> <option value="5">Region15</option> these then get passed and I want to use them in mysql query blah blah WHERE (t_state_id_state = $state[0]) Whats the best way of finding out how many items are in my array ? And how can I step through the ones the exist ? And can I only use LIKE % when my value is all ? thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#90236) next »