0

I am making a little side project and trying Tide SDK for the first time.

Is it possible to create an app that can work offline and when the PC has internet get the latest version of the DATA in the Web DataBase?

The person who will use the software will be most of the time offline and when has internet I wanted to update the local Database.

I only have the server side with PHP:

<?php
    mysql_connect("127.0.0.1", "root", "root") or die(mysql_error()); 
    mysql_select_db("ATA_test") or die(mysql_error());

    $sql = "SELECT * FROM ata_values_sync";
    $result = mysql_query($sql);
?>
<ul>
<?php    
    while($info = mysql_fetch_array( $result )) {
        echo "<li> 
        <h1> ATA " . $info['ATA'] . " </h1>
        <h1> " . $info['problema'] . " </h1>
        <h1> " . $info['solucao'] . " </h1>
        </li>";
    }

    mysql_free_result($result);
?>
</ul>

How can i accomplish this?

Im0rtality
  • 3,463
  • 3
  • 31
  • 41

1 Answers1

0

I end up searching for the answer on GitHub and end up finding what i wanted.

I will end up mixing functions of PHP and JavaScript for the Web / Local Database.

Keeping the php ± has I have already and adding this Javascript code:

var db = Titanium.Database.openFile(Titanium.App.appURLToPath("app://demo.db"));
var row = db.execute("select * from demo");
if (row.isValidRow()) {
    document.getElementById("message").innerText = row.fieldByName("message");
}

and an "Data.db" file in the app root!

Thanks anyways Guys.