By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,473 Members | 1,267 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,473 IT Pros & Developers. It's quick & easy.

Hi how do I join my php statement together and send it to actionscript?

P: 93
hi people I trying to join the 2 report1 and report2 together to send it to the actionscript for displaying the result how do I join them together plss help below is my code:
[PHP]
<?php
$temp="";

$sqlconnect=mysql_connect("localhost","hyperian_tr ack","gsmtrack");
if(!$sqlconnect)
die(mysql_error());
mysql_select_db("hyperian_track", $sqlconnect);


if($_POST['postal']))

$postalcode=substr($_POST['postal'],0,2); //will return from 0 position 2 characters

$resultpostal=mysql_query("SELECT startlat,endlat,startlng,endlng FROM districts
WHERE districtno = $postalcode"); //get startlat,endlat,startlng,endlng of location

while($row = mysql_fetch_array($resultpostal))
{
$temp[]=$row; // store each record in an array
}


foreach($temp as $key=>$extract)
$report=$report.$key."=".$extract."&";

echo '&report=1&';

$resultname=mysql_query("SELECT uname FROM location,districts
WHERE location.lat < districts.startlat AND location.lat > districts.endlat AND location.lng < districts.startlng
AND location.lng > districts.endlng");

while($row = mysql_fetch_array($resultname))
{
$temp[]=$row;
}



foreach($temp as $key=>$extract)
$report=$report.$key."=".$extract."&";

echo '&report=2&';
}//end of if loops



mysql_close($con);

[/PHP]

Instead of echo '&report=1&'; And echo '&report=2&'; seperately how do I combine them together and echo it to actionscript?
Jul 23 '07 #1
Share this Question
Share on Google+
4 Replies


dafodil
100+
P: 392
hi people I trying to join the 2 report1 and report2 together to send it to the actionscript for displaying the result how do I join them together plss help below is my code:
[PHP]
<?php
$temp="";

$sqlconnect=mysql_connect("localhost","hyperian_tr ack","gsmtrack");
if(!$sqlconnect)
die(mysql_error());
mysql_select_db("hyperian_track", $sqlconnect);


if($_POST['postal']))

$postalcode=substr($_POST['postal'],0,2); //will return from 0 position 2 characters

$resultpostal=mysql_query("SELECT startlat,endlat,startlng,endlng FROM districts
WHERE districtno = $postalcode"); //get startlat,endlat,startlng,endlng of location

while($row = mysql_fetch_array($resultpostal))
{
$temp[]=$row; // store each record in an array
}


foreach($temp as $key=>$extract)
$report=$report.$key."=".$extract."&";

echo '&report=1&';

$resultname=mysql_query("SELECT uname FROM location,districts
WHERE location.lat < districts.startlat AND location.lat > districts.endlat AND location.lng < districts.startlng
AND location.lng > districts.endlng");

while($row = mysql_fetch_array($resultname))
{
$temp[]=$row;
}



foreach($temp as $key=>$extract)
$report=$report.$key."=".$extract."&";

echo '&report=2&';
}//end of if loops



mysql_close($con);

[/PHP]

Instead of echo '&report=1&'; And echo '&report=2&'; seperately how do I combine them together and echo it to actionscript?
You can store them first in a variable and concatenate by using the dot operator..

For example $x=$report1.$report2;
Jul 23 '07 #2

P: 93
You can store them first in a variable and concatenate by using the dot operator..

For example $x=$report1.$report2;
hi how do I do it can show me example?
Jul 23 '07 #3

P: 93
just curious what is this part of the code doing?
[PHP]
while($row = mysql_fetch_array($resultpostal))
{
$temp[]=$row; // store each record in an array
}


foreach($temp as $key=>$extract)
$report=$report.$key."=".$extract."&";

echo '&report=1&';
[/PHP]
Jul 23 '07 #4

dafodil
100+
P: 392
just curious what is this part of the code doing?
[PHP]
while($row = mysql_fetch_array($resultpostal))
{
$temp[]=$row; // store each record in an array
}


foreach($temp as $key=>$extract)
$report=$report.$key."=".$extract."&";

echo '&report=1&';
[/PHP]
I think there is an error in your code....

Expand|Select|Wrap|Line Numbers
  1.  
  2. echo '&report=1&';
  3.  
  4.  
  5.  
The code above displays this
&report=1& in the browser....

Try to replace it with: echo $report;

Expand|Select|Wrap|Line Numbers
  1. while($row = mysql_fetch_array($resultpostal))
  2.         {
  3.             $temp[]=$row;                // store each record in an array
  4.         }
  5.  
As you can see the code extracts the record in the database and store it in a array $temp[]

Expand|Select|Wrap|Line Numbers
  1.  
  2.         foreach($temp as $key=>$extract)
  3.         $report=$report.$key."=".$extract."&";
  4.  
The code above allows you to retrieve the items in the $temp array and store it in the $report variable by concatenating it.


Hope you find your way through it..

Cheers
Jul 23 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.