Login PHP + AJAX for App

0 favourites
  • 10 posts
From the Asset Store
Paypal PHP Supports multiple platforms, Web/html5 Android, IOS. (Including storing transaction data)
  • I use the https://www.construct.net/en/tutorials/simple-login-using-a-mysql-database-312 tutorial.

    The Script is conected to the Database.

    This is the Script

    This is the AJAX.LastData Nothing

    I don´t know where is the issue.

    This is the eventshit

    Please i need some help i cant finish this part

    BTW i use always HTTPS protocol into the webserver also into the game.

    Tagged:

  • If I may suggest some troubleshooting things you can do:

    1. In a browser, run the ajax call in the URL line (https://site.com/file.php?username=xyz&password=123 [this assumes the user/pwd exist]

    and just make sure it is giving a return (ie, the php file is working properly)

    [If the php file runs, at least you know that part is correct and can move on with debugging.]

    2. If the php file is working, preview your project in a browser and pull up the browser debugger (developer tools). See if the project is throwing an error.

    If I had to guess right now...your php file is tossing an error on line 11

    You might also check your server to see if there is an error report.

  • I can try the last part later, cause i think all is ok...

  • PHP calls are a pain. If your file is called GET.php and you call Get.php it will not work. Which is why I suggested making certain the php file is working before wasting any more time on the construct side.

    (on line 11 you have [and], which if I'm not wrong has to be [AND]...it's little stuff that always gives me fits.

    Good Luck!

  • The URL works fine.

    Its AJAX or something of the script to give me the ID and that ID put it into de Ajax.Lastdata and then put on the variable UserID

  • Your UserID is a number. Your data coming in is a string from PHP. I would parse it to a integer then set it to your UserID.

  • How i can do that. I am learning by my own php but i dont know do that at this moment.

    I can have a ajax.lastdata with all the sentence SELECT id FROM, But not the result id from my database

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • The URL works fine.

    Its AJAX or something of the script to give me the ID and that ID put it into de Ajax.Lastdata and then put on the variable UserID

    I just want to double check: "Works fine"

    When you open a browser and on the URL type in your site address and php request with data it returns exactly what you want?

    example:

    yoursite.com/cgi-bin/file.php

    the php file runs and returns the correct id number in html format in your browser. Correct?

    (I use php / ajax everyday. So I'm just walking this through my normal troubleshooting process. Eliminating one problem at a time until complete.)

    If all that works, open your project in debugger mode. Under System, Ajax, lastdata, your id number should be there. If it is not, then check the browser log for an error. If still nothing, check that your ajax request.

    Assuming all that works, you probably just have a simple coding issue, maybe something as simple as Set ID = int(ajax.lastdata) as suggested above.

  • The php file connects to the database and I can do it, the problem is in the results chains of the script, since it is not well designed or it does not give me the value of id corresponding to username and password.

    I think the error is here cause that echo dont do nothing

    $qz = "SELECT id FROM members where username='".$username."' and password='".$password."'" ;

    $qz = str_replace("\'","",$qz);

    $result = mysqli_query($con,$qz);

    while($row = mysqli_fetch_array($result))

    {

    echo $row['id'];

    }

    mysqli_close($con);

    ?>

  • WHOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

    i DO IT!!!!!!!!!

    IM TOO HAPPY XD

    $qz = "SELECT id FROM members where username='".$username."' and password='".$password."'"

    Chante to this

    $qz = "SELECT id FROM members where username=$username and password=$password" ;

    and voala

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)