Re: is there a more efficient query?

From: Date: Fri, 06 Aug 2004 16:48:29 +0000
Subject: Re: is there a more efficient query?
Groups: php.general 
Request: Send a blank email to php-general+get-193014@lists.php.net to get a copy of this message
your only getting one row beucase your only pulling one row from the array. You need to loop thru the rows to grab them all. Jason Brian Tully <btully@gstockco.com> wrote: > > 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 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#193014) next »