Re: Final question of the week :-)

From: Date: Wed, 11 Dec 2002 08:27:49 +0000
Subject: Re: Final question of the week :-)
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-24053@lists.php.net to get a copy of this message
Hi, you could use "IN" in your query: $sql = "select * from..... where id in (0" // start your query if (count($selection) >= 1) { for ($i=0;$i<count($selection);$i++) { echo $selection[$i]; $sql .= ",".$selection[$i]; // add each ID to your query }}; $sql .= ")"; // finish the query, then execute it $res = mysql_query($sql); HTH, Bastian Chris Payne schrieb: > Hi there everyone, > > I use the following code to collect date from multiple tickboxes on my form: > > if (count($selection) >= 1) { > for ($i=0;$i<count($selection);$i++) { > > echo $selection[$i]; > > }}; > > $selection is the ID number and passes fine, but what I need it to do is > query my DB via the above query displaying the results from the multiple > ID's, how can I do this from this array? I know from a single ID / string > but not this way. > > Please help, i'm almost totally bald from frustration :-) > > Chris

« previous php.db (#24053) next »