mercredi 24 juin 2015

download values of sql table for offline reuse

I've got a Flash app that calls an online php file in order to read some values of my SQL table.

So I've got a line like this in my AS3 code:

var urlReq:URLRequest = new URLRequest ("http://ift.tt/1Ke84WK");

And this in my php :

 $connection = mysql_connect("mysql***.perso", "test", "password") or die ("Couldn't connect to the server.");

Problem : if the user is offline he can't access the values.

Is there way to download the SQL table with AS3 code (when the user have internet) in order to access it offline.

Like :

function onConnection(e:Event = null):void{
if(monitor.available)
            {
                trace("You are connected to the internet");
                read_php_online();
            }
            else
            {
                trace("You are not connected to the internet");
                read_php_offline();
            }

            monitor.stop();
        }

function read_php_offline():void{
    var urlReq:URLRequest = new URLRequest ("local/sql_result_offline.php");
..
..
}

And what should have sql_result_offline.php in order to access an offline SQL Table ?

 $connection = mysql_connect("LOCAL", "user", "password");

Thank you,

Aucun commentaire:

Enregistrer un commentaire