Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 05-16-2012, 10:43 AM   #1
raghunath
Registered User
 
Join Date: May 2012
Posts: 11
Default php and flash

Hi all,

I want to send data from flash to mysql using PHP ... and also i want to display the data on flash from mysql using PHP...

can it be possible if so please provide me a small example ...

thank ...
raghunath is offline   Reply With Quote
Old 05-16-2012, 10:57 AM   #2
northmantif
dont Re Member
 
Join Date: May 2009
Location: Poland
Posts: 739
Default

ActionScript Code:
import flash.net.URLVariables; import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.URLRequestMethod; import flash.events.Event; import flash.net.URLLoaderDataFormat; import flash.net.sendToURL; import flash.net.navigateToURL; var uv:URLVariables = new URLVariables(); var ur:URLRequest = new URLRequest(); var ul:URLLoader = new URLLoader(); var data1:Number = 4; var data2:String = "text"; uv.data1 = data1; uv.data2 = data2; ur.data = uv; ur.method = URLRequestMethod.POST; ur.url = "urlToThePHPFile/connect.php"; ul.addEventListener(Event.COMPLETE, onDataProvided); ul.dataFormat = URLLoaderDataFormat.VARIABLES; ul.load(ur); function onDataProvided(e:Event):void {     trace(e.target.data.output); }

connect.php
PHP Code:
<?php
$d1 
$_POST['data1'];
$d2 $_POST['data2'];
if(
$d1 == && d2 == "text" )
{

    print(
'output=Put some clothes on you fool!!!');
    
}
else
{
    
$output 'let me guess someone stole your sweetroll';
    print(
"output=$output");

}
?>

Last edited by northmantif; 05-16-2012 at 11:20 AM.
northmantif is offline   Reply With Quote
Old 05-16-2012, 03:21 PM   #3
ASWC
Super Moderator
 
ASWC's Avatar
 
Join Date: Dec 2007
Location: Greenville, SC
Posts: 6,528
Default

You use a gateway of some sort or even better amfphp but this is probably to much here. To run queries in mysql you do something like this in your php:
PHP Code:
$db mysql_connect("database link""username" "password");
$dbselect mysql_select_db("mydatabase"$db);//select your database
$query "select * from mytable";
$query_result mysql_query($query); 
__________________
aswebcreations
Super Duper!
ASWC is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:04 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.