[PAUL FERRIE]
01-22-2008, 06:42 PM
Ok so i figured i should make a start with AS3.
I decied to try and convert one of my current projects.
i have to say to get it to work i've had to comment out a lot of it's code and work through it piece by piece.
So i have figured out how to send and recieve data from a php script.
Didnt take long to figure out that AS3 did not like "&" in the output returned from php. In the case of the script i was using it was simple enough to remove the "&" as i was only returning one variable. So my question is what if i am returning more than one variable? Most of my php scripts consist of pulling multipul data from mysql and displaying it in flash.
example:
$output = "&newsCount=$newsCount";
for ($count = 0; $count < $newsCount; $count++){
$news = mysql_fetch_array($result);
$newsID = $news['newsID'];
//
$allComms = dbQueryFirst("SELECT COUNT(*) AS totalComm FROM idbloggcomm WHERE blogg_id = $newsID");
if (!$allComms) {
$totalComms = 0;
} else {
$totalComms = $allComms['totalComm'];
}
//------------------------------------------------------//
$output .= "&news" . $count . "newsID=" . $newsID;
$output .= "&news" . $count . "newsTitle=" . $news['newsTitle']
$output .= "&news" . $count . "newsStory=" . $news['newsStory'];
$output .= "&news" . $count . "newsDate=" . $newsDate = date("j/m/y", strtotime($news['newsDate'];));
$output .= "&news" . $count . "newsHits=" . $news['newsHits'];
$output .= "&news" . $count . "newsComms=" . $totalComms;
}
$allNews = dbQueryFirst("SELECT COUNT(*) AS totalNews FROM idblogg");
if (!$allNews) {
$totalNews = 0;
} else {
$totalNews = $allNews['totalNews'];
}
$pages = ceil($totalNews / $newsPerPage);
$output .= "¤tPage=$page&totalPages=$pages&totalNews=$totalNews&newsPerPage=$newsPerPage";
//
echo $output."&retval=1&";
how do i effectively pull all this back into flash without "&" to split the variables?
Thanks
Paul
I decied to try and convert one of my current projects.
i have to say to get it to work i've had to comment out a lot of it's code and work through it piece by piece.
So i have figured out how to send and recieve data from a php script.
Didnt take long to figure out that AS3 did not like "&" in the output returned from php. In the case of the script i was using it was simple enough to remove the "&" as i was only returning one variable. So my question is what if i am returning more than one variable? Most of my php scripts consist of pulling multipul data from mysql and displaying it in flash.
example:
$output = "&newsCount=$newsCount";
for ($count = 0; $count < $newsCount; $count++){
$news = mysql_fetch_array($result);
$newsID = $news['newsID'];
//
$allComms = dbQueryFirst("SELECT COUNT(*) AS totalComm FROM idbloggcomm WHERE blogg_id = $newsID");
if (!$allComms) {
$totalComms = 0;
} else {
$totalComms = $allComms['totalComm'];
}
//------------------------------------------------------//
$output .= "&news" . $count . "newsID=" . $newsID;
$output .= "&news" . $count . "newsTitle=" . $news['newsTitle']
$output .= "&news" . $count . "newsStory=" . $news['newsStory'];
$output .= "&news" . $count . "newsDate=" . $newsDate = date("j/m/y", strtotime($news['newsDate'];));
$output .= "&news" . $count . "newsHits=" . $news['newsHits'];
$output .= "&news" . $count . "newsComms=" . $totalComms;
}
$allNews = dbQueryFirst("SELECT COUNT(*) AS totalNews FROM idblogg");
if (!$allNews) {
$totalNews = 0;
} else {
$totalNews = $allNews['totalNews'];
}
$pages = ceil($totalNews / $newsPerPage);
$output .= "¤tPage=$page&totalPages=$pages&totalNews=$totalNews&newsPerPage=$newsPerPage";
//
echo $output."&retval=1&";
how do i effectively pull all this back into flash without "&" to split the variables?
Thanks
Paul