Got the query, Cant figure out the right code to display it..

Hi,

the following query:
[php]$query1 = “SELECT d.value, c.value, d.user_id, (SQRT(POW((b.x - a.x), 2) + POW((b.y - a.y), 2))/1000) * 0.621 AS distance
FROM postcodes a, postcodes b, wp_bp_xprofile_data c JOIN wp_bp_xprofile_data d
ON c.user_id=d.user_id AND d.field_id=1
WHERE a.outcode = '”.$postcode."’ AND b.outcode = c.value
HAVING (distance < ‘".$area."’)
ORDER BY distance asc ";
[/php]

when i run it on the database, returns exactly what i want.

I just need the php code to display all the info.

My code (trunkated):

[php]// display results
while ($list = mysql_fetch_array($result1)) {
$user_postcode = $list[‘value’];
$distance = $list[‘distance’];
$distance = round($distance);
echo “<td colspan=“3” align=“left”>$user_postcode”;
[/php]

Will display only one of the ‘value’, from the wp_bp_xprofile_data table…

Any help? Any more info you need?

Thanks

In short, how to define the other returned ‘value’ to a $variable?

I got it…

Define them 1st using AS, then getting them back with

mysql_fetch_assoc.

Thanks for the help. =)

Sponsor our Newsletter | Privacy Policy | Terms of Service