Hi everyone,
Wasn't sure where to post this one as I'm not sure where the error is occuring.
I have datagrid components being populated from a mySQL DB using php. The grids exist on external swfs being loaded into a parent clip.
The datagrids populate locally no problem when tested individually and when loaded into the parent clip. They have also been working from the server in previous days, but I was doing final tests checks on some recent final changes and now things aren't working.
obviously I went back and ran through what I changed but nothing really applied to the grids.
I'm right on deadline and any advice would help.
Codes are below
Cheers
AS
Code:
//DISPLAY ON TAP BEERS
var myOnGridArray:Array = [];
myOnGridArray.push({status:"loading data..."});
myOnGrid.dataProvider = myOnGridArray;
var myDataHolder:Array = [];
var sender:LoadVars = new LoadVars();
var receiver:LoadVars = new LoadVars();
receiver.onLoad = function(ok) {
if (ok) {
myOnGrid.removeAllColumns();
myOnGrid.removeAll();
for (var i = 1; i<=receiver.total; i++) {
receiver["dataPacket"+i] = receiver["user_data"+(i)].split("|");
var _ID:String = receiver["dataPacket"+i][0];
var _beerName:String = receiver["dataPacket"+i][1];
var _type:String = receiver["dataPacket"+i][2];
var _ABV:String = receiver["dataPacket"+i][3];
var _description:String = receiver["dataPacket"+i][4];
var _link:String = receiver["dataPacket"+i][5];
var _brewery:String = receiver["dataPacket"+i][6];
var _breweryLocation:String = receiver["dataPacket"+i][7];
var _status:String = receiver["dataPacket"+i][8];
var _location:String = receiver["dataPacket"+i][9];
myOnGridArray.push({bottleID:_ID, Name:_beerName, Type:_type, ABV:_ABV, Description:_description, Link:_link, brewery:_brewery, breweryLocation:_breweryLocation, Status:_status, bottleLocation:_location});
var dataObj:Object = {};
dataObj.ID = _ID;
dataObj.beerName = _beerName;
dataObj.type = _type;
dataObj.ABV = _ABV;
dataObj.description = _description;
dataObj.link = _link;
dataObj.brewery = _brewery;
dataObj.breweryLocation = _breweryLocation;
dataObj.status = _status;
dataObj.location = _location;
myDataHolder.push(dataObj);
delete (receiver["user_data"+i]);
}
myOnGrid.dataProvider = myOnGridArray;
setupGrid();
} else {
myOnGrid.removeAllColumns();
myOnGrid.removeAll();
myOnGridArray.push({Status:"No data was found!"});
myOnGrid.dataProvider = myOnGridArray;
}
myOnGrid.removeColumnAt(8);
myOnGrid.removeColumnAt(7);
myOnGrid.removeColumnAt(6);
myOnGrid.removeColumnAt(5);
myOnGrid.removeColumnAt(4);
myOnGrid.removeColumnAt(3);
myOnGrid.removeColumnAt(0);
};
sender.sendAndLoad("http://myclientsdomain/SHARED/scripts/onTap.php",receiver,"post");
setupGrid = function(){;
var myOnGridSensorObj:Object = {};
myOnGridSensorObj.cellPress = function(){;
if(myOnGrid.selectedIndex == undefined){;
trace("error");
}else{;
var userData:Array = myDataHolder[myOnGrid.selectedIndex];
showDetails(userData.ID,userData.beerName,userData.type,userData.ABV,userData.description,userData.link,userData.brewery,userData.breweryLocation,userData.status,userData.location);
};
};
myOnGrid.addEventListener("cellPress",myOnGridSensorObj);
};
showDetails = function($ID:Number,$beerName:String, $type:String, $ABV:String, $description:String, $link:String,$brewery:String, $breweryLocation:String, $status:String, $location:String){;
beerID.text = ""+$ID+"";
beerName.htmlText = ""+$beerName+"";
beerType.htmlText = ""+$type+"";
ABV.htmlText = ""+$ABV+"";
beerDescription.htmlText = ""+$description+"";
link.htmlText = ""+$link+"";
brewery.htmlText = ""+$brewery+"";
breweryLocation.htmlText = ""+$breweryLocation+"";
statusOn.selected = true;
//trace($bottleLocation);
if ($location=="Mel") {;
locationMel.selected = true;
}else if ($location=="Syd") {;
locationSyd.selected = true;
}else if ($location=="Both") {;
locationBoth.selected = true;
};
};
PHP
PHP Code:
<?php
$server = "xxxxxxxx";
$user = "xxxxxxxxxx";
$pass = "xxxxxxx";
$database = "xxxxx";
$conn = @mysql_connect($server,$user,$pass);
$database = @mysql_select_db($database,$conn);
$query = @mysql_query('SELECT * FROM `taps` WHERE location NOT LIKE "Mel" AND status = "onTap" ORDER BY beerID desc');
$total_rows = @mysql_num_rows($query);
$counter = 0;
while($ourData = @mysql_fetch_array($query)){
$beerID = $ourData["beerID"];
$beerName = $ourData["beerName"];
$beerType = $ourData["beerType"];
$ABV = $ourData["ABV"];
$brewery = $ourData["brewery"];
$breweryLocation = $ourData["breweryLocation"];
$counter++;
print("&user_data$counter=$beerID|$counter|$beerName|$beerType|$ABV|$brewery|$breweryLocation");
}
print("&total=$total_rows");
?>