Well i havent seen anyone been using BETWEEN.
Anyway...

<?php
$SQL = mysql_query("SELECT value FROM table_name WHERE element BETWEEN 48 AND 53");


while($row = mysql_fetch_arrray($SQL)) {
  print($row['value']);
}
mysql_free_result($SQL);
?>


From: "Jason Davidson" <[EMAIL PROTECTED]>
To: "Brian Tully" <[EMAIL PROTECTED]>, "Jay Blanchard" <[EMAIL PROTECTED]>, " PHP" <[EMAIL PROTECTED]>
Subject: Re: [PHP] is there a more efficient query?
Date: Fri, 6 Aug 2004 09:48:29 -0700


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 <[EMAIL PROTECTED]> wrote:
>
> on 8/6/04 12:28 PM, Jay Blanchard at [EMAIL PROTECTED]
> 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
>
>


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


_________________________________________________________________
Chatt: Träffa nya nätkompisar på Habbo Hotel http://habbohotel.msn.se/habbo/sv/channelizer


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



Reply via email to