Re: Pulling data from a table into a array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 15 November 2004 15:54, Richard wrote:
> I am using mysql_fetch_row to pull data from a table to fill an array
> But I am not getting the data into the array the way I whant it to be.
>
> $query = "SELECT amenityID FROM property_amenity where listingId =
> '$listingId'";
> $results = mysql_query($query);
>  if ($results) {
>    while ($list=mysql_fetch_row($results)) {

You are really *much* better off using mysql_fetch_assoc().

>     $checked[]=$list;

Instead of of slapping the whole of $list into $checked, just stick in the bit 
you want, namely amenityID.

So assuming you've changed to using mysql_fetch_assoc():

  $checked[]=$list['amenityID'];

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
>  Where in the US is Linus?

He was in the "Promise Land".
 -- David S. Miller <davem@xxxxxxxxxxxxxxxx>
*/

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux