Re: is there a more efficient query?

From: Date: Fri, 06 Aug 2004 16:35:21 +0000
Subject: Re: is there a more efficient query?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-193012@lists.php.net to get a copy of this message
on 8/6/04 12:28 PM, Jay Blanchard at jay.blanchard@niicommunications.com wrote: > [snip] > Tis SQL .... > > SELECT value > FROM element_values > WHERE user = $user_id > AND(element=48 > OR element=52 > OR and so on....) > [/snip] > > You can also use IN > > SELECT value > FROM element_values > WHERE user = $user_id > AND element IN ('48', '52',...) thanks Jay! but that only seems to return the first value. how should I be calling the results? $query2 = "SELECT value FROM element_values WHERE " . "(element=48 OR element=49 OR element=50 OR element=51 OR element=52 OR element=53) " . "AND user=$user_id"; $result2 = mysql_query($query2) or die("could not $query2 " . mysql_error()); list($user_name, $address_street, $address_city, $address_state, $address_zip, $phone) = mysql_fetch_array($result2); do i need to do a while loop and create an array or something? thanks again. brian

« previous php.general (#193012) next »