[PHP] Finding array in MySQL (I'm not asking the right question)

2003-12-02 Thread Dave G
PHP Gurus, What I'm trying to do must be both common and simple, but I'm not asking the question right because I can't find the answers in Google or the online PHP manual using the search words like array, find, PHP, MySQL, etc... I have an array, and I want to select the fields in

Re: [PHP] Finding array in MySQL (I'm not asking the right question)

2003-12-02 Thread Sophie Mattoug
You can do something like $str = '.implode(', ', $arr).'; $query = SELECT * FROM table WHERE id IN ($str); Hope this helps, -- Cordialement, --- Sophie Mattoug Développement web dynamique [EMAIL PROTECTED] --- Dave G wrote: PHP Gurus, What I'm

RE: [PHP] Finding array in MySQL (I'm not asking the right question)

2003-12-02 Thread Jay Blanchard
[snip] Well, SELECT email FROM table WHERE id = . $array . ); [/snip] $arrayUser[1] = 'bob'; $arrayUser[2] = 'cindy'; $arrayUser[1] = 'mark'; $countUser = count($arrayUser); for($i = 0; $i $countUser; $i++){ $sql = SELECT email FROM table WHERE id = ' . $arrayUser[$i] . ' ; }

Re: [PHP] Finding array in MySQL (I'm not asking the right question)

2003-12-02 Thread Marek Kilimajer
SELECT email FROM table WHERE id IN (' . implode(',',$array) . '); And don't forget to check if $array really contains only numeric values. Dave G wrote: PHP Gurus, What I'm trying to do must be both common and simple, but I'm not asking the question right because I can't find the

Re: [PHP] Finding array in MySQL (I'm not asking the right question)

2003-12-02 Thread Chris Boget
$arrayUser[1] = 'bob'; $arrayUser[2] = 'cindy'; $arrayUser[1] = 'mark'; $countUser = count($arrayUser); for($i = 0; $i $countUser; $i++){ $sql = SELECT email FROM table WHERE id = ' . $arrayUser[$i] .' ; } Is this method faster than just using IN and implode()? ie, WHERE id IN ( ' .

RE: [PHP] Finding array in MySQL (I'm not asking the right question)

2003-12-02 Thread Jay Blanchard
[snip] $arrayUser[1] = 'bob'; $arrayUser[2] = 'cindy'; $arrayUser[1] = 'mark'; $countUser = count($arrayUser); for($i = 0; $i $countUser; $i++){ $sql = SELECT email FROM table WHERE id = ' . $arrayUser[$i] .' ; } Is this method faster than just using IN and implode()? ie, WHERE id IN ( '

RE: [PHP] Finding array in MySQL (I'm not asking the right question)

2003-12-02 Thread Dave G
Is this method faster than just using IN and implode()? Thanks to all who replied. I believe I have found what I'm looking for in using the implode() command. My assumption is that it was faster and more efficient to try and do as much processing on the PHP side and make as few queries to the

Re: [PHP] Finding array in MySQL (I'm not asking the right question)

2003-12-02 Thread Sophie Mattoug
Dave G wrote: Is this method faster than just using IN and implode()? Thanks to all who replied. I believe I have found what I'm looking for in using the implode() command. My assumption is that it was faster and more efficient to try and do as much processing on the PHP side and make as few

RE: [PHP] Finding array in MySQL (I'm not asking the right question)

2003-12-02 Thread Dave G
Totally wrong ! It's always better to have maximum work done by MySQL So does that mean that this: $countUser = count($arrayUser); for($i = 0; $i $countUser; $i++){ $sql = SELECT email FROM table WHERE id = ' . $arrayUser[$i] . ' ; } ... is faster than this: SELECT email FROM