Nicolvian's Forum Posts

  • Me background is not visible in the game.

  • Hello.

    I put my background on the layer hud with a Parallax of 0%, 0%.

    except that my object layer overlaps despite me on the layer hud.

  • Good morning all.

    I wanted to accelerate the ball.

    and removed it 1.0 second later.

    off the ball continues to have the acceleration of 100.

    my initial goal was to give a boost to my ball.

  • Hello.

    as I want to import AJAX on a project for a little while they show me an error.

    Added 'AJAX', This object is available to the entire project. ...

    I'm on Windows 10 maybe that matters?

    Tagged:

  • except that I want to make a POST request not GET.

  • Hello.

    I block again on construct 2 at the POST request level.

    Ajax communicates well with my file because they return the echo to me.

    except that I have the impression that AJAX does not return the pseudo field to php.

    header("Access-Control-Allow-Origin: *"); if(!empty($_POST["register_pseudo"])){ echo "entrer"; }else{ echo "le champ pseudo ne peut pas etre vide"; }

  • Hello.

    I finally succeeded after following your advice.

    I wanted to know if I make a login system with AJAX can then log on?

    how to open it?

  • so it's not safe if I have to go through an echo for ajax to return a value .....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello.

    thank you for your reply !

    I took some time to answer you because I set up the SSL certificate I had to buy a server temporarily for the test.

    but I always get the same problem with one thing.

    now ajax returns to me the value of an error.

  • Hello everyone.

    it will be several days that I can not use Ajax to get the data from a php file.

    here is my code:

    $test = $_GET["test"];

    3 line of code with a simple variable with a $ _GET inside.

    on the example there is no interest.

    it's just for the test.

    here is my visual code on construct 2 :

    what I would like and recover what my variable contains.

    here is the location of my exported project and at the same time the location of the php file :

    they and put at the root of my local server.

    my local server and create with xampp.

    I saw that sometimes they had to meter :

    header('Access-Control-Allow-Origin: *');

    on my php file.

    except that every time nothing happens.

    the text remains empty.

    I really need help.

    if I send data to MYSQL there is no problem.

    if I want to retrieve data from a variable it does not work.

    I tried to use: On error.

    nothing changes .

  • You do not have permission to view this post

  • ok thanks for the help.

    me my database works.

    if i create a form directly from my login.php page.

    it works to send and receive ...

  • nicolas

  • just the username I got from the input field.

    they exist in the database ..

  • <?php
    header('Access-Control-Allow-Origin: *');
    $base = new mysqli('localhost', 'root', '', 'stockage');
    // Check connection
    if ($base->connect_errno) {
     die("Failed to connect to MySQL: " . $base->connect_error);
    }
    
    $sql = "SELECT id FROM user where username = ?";
    
    if (!$stmt = $base->prepare($sql))
    {
     echo "Prepare failed: (" . $stmt->errno . ") " . $stmt->error;
    }
    if (!$stmt->bind_param("s", $_GET['name'])){
     echo "Bind failed: (" . $stmt->errno . ") " . $stmt->error;
    }
    if (!$stmt->execute()){
     echo "Execute failed: (" . $stmt->errno . ") " . $stmt->error;
    }
    if (!$result = $stmt->get_result()) {
     echo "Get result failed: (" . $stmt->errno . ") " . $stmt->error;
    }
    if ($result->num_rows > 0) {
     $row = $result->fetch_object();
     echo $row->id;
    }
    else
    {
     echo 'No user found with that name';
    }
    ?>
    

    I do not know mysqli.

    I always went through PDO.

    the error now returns:

    No user found with that name.

    and yes, there are no passwords.

    I am local with wamp.

    my connection to the database in PDO works.

    she is correct.

    in this case I found it's result.

    on the internet for the function.

    I do not know how it works

    php.net/manual/fr/pdostatement.bindparam.php