facebook

Sample Mysql – PHP program

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #349058 Reply

    ejosephss
    Member

    Hi, Can anyone please give me a sample mobione program that connects and display data from mysql?
    I want to create a mobile web app that will display the data from mysql database based on the value that i will choose.

    I have made a php-mysql connection and it is working fine using xampp But how and where can i put it on mobione to make it work.. Sorry for my beginners question.. Thanks in advance!

    #349061 Reply

    Code_A
    Member

    Here is a working example using AJAX. I found this to be very helpful. Maybe you will too.
    viewtopic.php?f=19&t=666

    #349063 Reply

    ejosephss
    Member

    @Code A wrote:

    Here is a working example using AJAX. I found this to be very helpful. Maybe you will too.
    viewtopic.php?f=19&t=666

    Thanks for your response! I cannot access this link.. https://drive.google.com/file/d/0B4ojr4ueF89DUFlRQ083VFptRkE/edit?usp=sharing

    it says “Invalid Server Certificate”

    #349078 Reply

    Code_A
    Member

    I have attached the example file.

    I have modified the AJAX function a bit to include a few more parameters:

    function sendRequest(cmd, method, data, content, sync, send){
    
        if (send){
            //post data
            var webReq = jQuery.ajax({url: cmd,type: method,dataType : data,contentType : content, async : sync, data : send});
        }else{
            var webReq = jQuery.ajax({url: cmd,type: method,dataType : data,contentType : content, async : sync});
        }
            webReq.done(function( webText, status, jqXHR ) {
            // Process incoming data here
            response = webText;
            return;
        });    
            
        webReq.fail(function( jqXHR, status, errorThrown ) {
            response = false;
            return;
        });
         
        webReq.always(function( jqXHR, status, errorThrown ) {
        return;
        });
        
        return response;
    }

    Here is an example of how to call the function:

    var postVar = "something to pass";
    var url = "http://<your_web_service>/format/json";  //example url
    var send = JSON.parse('{"var" : "'+ postVar +'"}');
    this.response = sendRequest(url, "POST", "json","application/x-www-form-urlencoded; charset=UTF-8", false, send );    
    Attachments:
    You must be logged in to view attached files.
Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Sample Mysql – PHP program

You must be logged in to post in the forum log in