Software Archive
Read-only legacy content
17060 Discussions

Connect application with MYSQL

Sero_V_
Beginner
1,738 Views

Hello!

I am a newbie trying to make an application, but i am stock because i am still learning all about this world of hybrid-apps.

My question is this, i have this application made by the app-designer and it's ok but i have no idea how to connect my application to the server database, i readed a lot of tutorials and I found about the web services so i did it i created the web service but after this point i have no idea! This created 3 files for me but i don't know what to do with them, Do i need an API key to connect my app?

I know that i must query my app to get the data from the DB with JSON but i don't know where to put or even write code to connect the app. My app will show some budgets, So i need to login with email and password and then show the concepts.

So i am here asking for some help or someone who can guide me, i just need to learn the path and i will search for myself!

Hope someone can help me and sorry for my bad english!

Sergio

Regards! 

 

0 Kudos
9 Replies
Amrita_C_Intel
Employee
1,738 Views

Are you trying to save locally? 

I believe this link will help you-- http://stackoverflow.com/questions/22828109/intel-xdk-connecting-your-mobile-app-to-a-database

and specifically this one--https://software.intel.com/en-us/articles/html5-local-storage

0 Kudos
Sero_V_
Beginner
1,738 Views

Hello!

No, I am trying to read data from a MYSQL server, so local storage is no viable for me!

But thanks for trying, those links help me to understand more the process to connect the app to the server.

0 Kudos
Nick_F_2
New Contributor III
1,738 Views

You need to create either an ASP.NET web service or PHP web service.

Pass your query to the web service and return the result as JSON data.
 

Parse the JSON data in javascript in XDK to display your data.

0 Kudos
Marcondes__Marcos
1,738 Views

Hello

This is a Brasil portuguese video but explain intel xdk and mysql connection

https://www.youtube.com/watch?v=XvkoPP05wtk

Download the files on description may help

Marcos

0 Kudos
Michael_O_2
New Contributor I
1,738 Views

Create your back end in PHP or ASP and call them like this:

var input ="Michael";

//Main function call it from your code
function CallBackEnd(){
intel.xdk.device.getRemoteDataWithID("http://yourserver.com/webservice.php","POST","&user="+input,"CallBackS","CallBackF","12345");
}

//Success callback
function CallBackS(uniqueid,data){
console.log(data);
alert("Response from server is "+data );
}
//Error call back
function CallBackF(uniqueid,data){
alert("Network problem");
}

The main function above will POST  the variable user via the value "input".

In you PHP code you can do:

<?php
$data = $_POST['user'];
echo "$data";
?>

In Html 

Do this: <button onclick="CallBackEnd();">Push Data</button>

 

0 Kudos
Krishna_A_
Beginner
1,738 Views

Michael O. wrote:

Create your back end in PHP or ASP and call them like this:

var input ="Michael";

//Main function call it from your code
function CallBackEnd(){
intel.xdk.device.getRemoteDataWithID("http://yourserver.com/webservice.php","POST","&user="+input,"CallBackS","CallBackF","12345");
}

//Success callback
function CallBackS(uniqueid,data){
console.log(data);
alert("Response from server is "+data );
}
//Error call back
function CallBackF(uniqueid,data){
alert("Network problem");
}

The main function above will POST  the variable user via the value "input".

In you PHP code you can do:

<?php
$data = $_POST['user'];
echo "$data";
?>

In Html 

Do this: <button onclick="CallBackEnd();">Push Data</button>

 

Hello Michael,

I am new to mobile and web development, so please give me a working example of Web API or web service to retrieve and insert data on SQL and MySQL server using Intel XDK for mobile applications.

How to write, deploy Self Developed Web API or Web Service and consume those service for my mobile app.

Thanks to you in advance you can contact me 20krish@gmail.com

0 Kudos
Nick_F_2
New Contributor III
1,738 Views

See here for both a PHP and ASP.NET example.

https://software.intel.com/en-us/forums/intel-xdk/topic/549664

0 Kudos
Krishna_A_
Beginner
1,738 Views

Hello Nick,

With your help i have done data fetching from my SQL Server to my website using C#.

But i am still unable to fetching data in mobile app.

If there is any suggestions, please suggest me.

I would try today for mobile app in Intel XDK.

Thanks Again Bro...

0 Kudos
Nick_F_2
New Contributor III
1,738 Views

Have you published your webservice to a webserver for the purposes of testing.

Can you PM me a link to the webservice with any relevant inputs required to retrieve the data so I can take a look.

0 Kudos
Reply