473,326 Members | 2,125 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

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
4 1338
dafodil
392 256MB
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
Rocky86
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
Rocky86
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
392 256MB
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

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

Similar topics

3
by: Phil Powell | last post by:
I'm not kidding, the only reason yesterday you didn't hear from me was because I wasn't coding, but today I am doing something quick, and yes, as always it failed.. right at the SQL statement: ...
1
by: Paul Bramscher | last post by:
Here's one for pathological SQL programmers. I've got a table of things called elements. They're components, sort of like amino acids, which come together to form complex web pages -- as nodes...
13
by: kieran | last post by:
Hi, I have the following SQL statement which is pulling a few details from a database. As you can see, there is only the one table from which i am creating a temporary copy. The reason I do...
6
by: Thomas Beutin | last post by:
Hi, i've a speed problem withe the following statement: SELECT DISTINCT pz.l1_id, pz.l2_id, pz.l3_id, pz.l4_id FROM ot_adresse AS a, ot_produkt AS p LEFT OUTER JOIN ot_kat_prod AS pz ON (...
7
by: stabbert | last post by:
I am attempting to join two tables together on two different unix servers. Here is some relevant info about the tables. TABLE 1 Setup ----------------------- DB2 UDB 7.2 EE
2
by: Elizabeth Harmon | last post by:
Hi All I am just double checking myself here. I have two threads that i am running in an application, One Thread Updates a client side Table in a local DB, another Updates a Server Side Table...
5
by: gimme_this_gimme_that | last post by:
I have an employee table with two columns, one named login, the other named otherdata. I have a list of login values, some of which do not exist in the employee table. I want to fetch the...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
27
by: Paulo da Silva | last post by:
Hi! I was told in this NG that string is obsolet. I should use str methods. So, how do I join a list of strings delimited by a given char, let's say ','? Old way:
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.