search in a local database (sql) with AS3

2019-08-11 05:55发布

问题:

I've got an AS3 code that I want to link with a php. That php search in a database (sql) and send results to my AS3 code.

So I've got 3 files : my project (FLA file), my php file, and my sql file.

I would like to do this operation offline (local).

How can I do ?

In my AS3 code I've got :

var urlreq = new URLRequest("myPHP.php");
    urlreq.method = URLRequestMethod.POST;

    var urlVars = new URLVariables();

    urlVars.theport = "New-York";
    urlreq.data = urlVars;  

    var loader:URLLoader = new URLLoader(urlreq);
    loader.addEventListener(Event.COMPLETE, completed);
    loader.dataFormat = URLLoaderDataFormat.VARIABLES;
    loader.load(urlreq); 

In my php :

$theport = $_POST['theport'];
...

linked to a conn.php file :

$cfg_hote = 'mys****.perso';        
$cfg_base = '******';           
$cfg_user = '*****';            
$cfg_password = '****rhx';

And I've got an sql file uploaded at phpmyadmin.ovh.net

So now, how can I do this operation offline (local) ?


EDIT

So, I've created a db file with SQLite Browser. Now, how can I link my AS3 code (AIR apps) to my php to my database ?

  1. My php got the code to search into the database.
  2. My database is created and is in the same folder as the project.