# Use a database in an AIR app (AS3) with a php, LOCALLY

**URL:** <https://forum.kirupa.com/t/use-a-database-in-an-air-app-as3-with-a-php-locally/634020>\
**Category:** flash\
**Created:** [December 4, 2015, 10:29pm UTC](https://forum.kirupa.com/t/use-a-database-in-an-air-app-as3-with-a-php-locally/634020 "2015-12-04T22:29:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stephan\_Berger](https://avatars.discourse-cdn.com/v4/letter/s/3bc359/32.png) [@Stephan\_Berger](https://forum.kirupa.com/u/Stephan_Berger)\
**Post date:** [December 4, 2015, 10:29pm UTC](https://forum.kirupa.com/t/use-a-database-in-an-air-app-as3-with-a-php-locally/634020/1 "2015-12-04T22:29:39Z")

</div>

Hi,

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

So I’ve got 3 files : my project (FLA file), my php file, and my sql file (and a db file if it’s necessary).

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'];
//and code dealing with database

```

linked to a conn.php file :

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

```

How can I do to call the php, make hime use the database locally ? (I know how to do so when the database and the php are online).

Thx ,
