PDA

View Full Version : flash mx2004 php urgent help


amjad
04-06-2004, 08:42 AM
hi all

i'm using flash mx2004 and php 4+ but i've some issues on flash side

i've a table called organization this has 3 columns (orgId, orgName, Des)
and has 10 rows of records as data
but when i tryed 2 retrive in that data in flash, that only returns me a last and single row from table. As i said there are 10 record on my table so, how do I get each organization and its description in flash?

my php code Something like this...include ("connection.php");
$query = "select Organization_Name, Description from ecards";
$result = mysql_query($query);
while($rows = mysql_fetch_array($result)){
$list = "<b>Name : </b>" .$rows["Organization_Name"];
$list .= "<b>Description : </b>" .$rows["Description"] ."<br>";
}
print "&list=" . urlencode($list) . "&";

and flash code
var loadphp = new LoadVars();
loadphp.onLoad = function(success){
if(success){
list = this.list;
} :confused:
}
loadphp.load("test.php");


plz help i'm stuck, wat should i do 2 get the complete data from db
any suggession would be apperciated

thanx
amjad

____
04-06-2004, 12:24 PM
everything looks right to me
but you could always just try some different php code and see if you get better results
This'd work the same

$rows=mysql_num_rows($result);

for($i=0; $i<$rows; $i++){
$array=mysql_fetch_array($result);

using pretty much your same code around that
sorry if i was no help

Das123
04-07-2004, 11:00 PM
Here's one method:

test.php only contains the following:

include ("connection.php");
$query = "select Organization_Name AS name, Description AS desc from ecards";
$result = mysql_query($query);
$i = 0;
while ($row= mysql_fetch_assoc($result)) {
echo "&Name".$i."=".urlencode($row['name']);
echo "&Desc".$i."=".urlencode($row['desc']);
$i++;
}
echo "&total=".$i."&";

Each row of your data needs to be specific and needs to be seperated with an ampersand. You need to pass information that looks like...

&Name0=name&Desc0=description&Name1=another name&Desc1= ...etc... & total=10&

It is a good idea to start and end the data with an ampersand.

In Actionscript:
var list = new Array();
var loadphp = new LoadVars();
loadphp.onLoad = function(success){
if(success){
for (var i = 0; i < Number(this.total); i++) {
var item = new Object();
item.name = this["Name" + i];
item.desc = this["Desc" + i];
list.push(item);
}
} else {
trace("Not loaded!");
}
};
loadphp.load("test.php");

amjad
04-12-2004, 11:36 AM
thanx Das

i uesed this and that php code works but flash code dosent work properly when i use this flash code it only display me _level0.list plz help me again

thanx

brock
05-04-2004, 01:45 PM
Hey, now how do you display that info in flash, like in a table for example? That would be SOO much appreciated! :D

CyanBlue
05-05-2004, 08:55 AM
What's that 'list' in list = this.list; line??? I mean the first list??? Is it the variable name or the textField instance name or the textField variable name??? At any rate, try this...

yourTextFieldInstanceName.text = this.list

Microshaft
11-27-2004, 03:06 PM
Hi,

just been trying out new and i have got stuck with Das suggestion.

How do i get to display each record entry in a separate text box.im totally confused with the List array and item object. How do i display the third element of the array.

can someone help me understand all this.

cheers