[Phpwm] How to get a single string from different queries?

Phil Beynon phil at infolinkelectronics.co.uk
Wed Apr 19 20:52:35 BST 2006


> Hi all,
>
> Thank you for the responses.  I agree, the database structure is a bit
> convoluted (I wish it was more of a standard structure). I am
> using an open
> source project (http://www.open-realty.org/) and that is the way their
> database is structured.
>
> I tried Elliot’s solution and it works perfectly, except it returns only
> record set in the database (for all four fields – address, city,
> state and
> zip).  How do I do a while loop, so that it will get results for all the
> records in the database.
>

Just a chunk of code which you can use as required, this will place all
returned elements of the query into an array called $rawdata;

$i=1; // just a counter variable
while($row = mysql_fetch_array($result,MYSQL_ASSOC)){$rawdata[$i] = $row;
$i++;}// raw data to array
print_r($rawdata); // show $rawdata

$i will also tell you how many element sets are in the array, saves doing a
count() in the query.

Regards,

Phil Beynon

** Infolink Electronic Systems Ltd. http://www.infolinkelectronics.co.uk
** Professional Web Design & Cobalt Hosting Solutions
** Contact: Sales at infolinkelectronics.co.uk
** Tel / Fax 0121 458 4894 (office) 0121 441 3558 (home) 07801 548464
(mobile)





More information about the Phpwm mailing list