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

From: Date: Tue, 02 Dec 2003 15:44:23 +0000
Subject: RE: [PHP] Finding array in MySQL (I'm not asking the right question)
Groups: php.general 
Request: Send a blank email to php-general+get-171594@lists.php.net to get a copy of this message
[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 ( '" . implode() . "' )" [/snip] No, because it requires the query be run more than once, but you may not get the desired results.

« previous php.general (#171594) next »