Re: Final question of the week :-)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux