Fengist's Forum Posts

  • Because now you changed $base to $bdd

    <?php
    
    try
    {
     $base = new PDO('mysql:host=localhost;dbname=stockage;charset=utf8', 'root', '');
    }
    catch (Exception $e)
    {
     die('Erreur : ' . $e->getMessage());
    }
    	$sql = "SELECT id FROM user where username = ?";
    	$stmt = $base->prepare($sql);
    	$stmt->bind_param("s", $_GET['name']);
    	$stmt->execute();
    	$result = $stmt->get_result();
    	$row = $result->fetch_object();
    	echo $row->id;
    
    ?>

    Assuming you have a table named user with a field username and a field id (and those are case sensitive) this should work.

    login.php?name=theusername should give you the ID

    Once it works, but this back at the top:

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

  • Then you need to check and see if the php file is actually working by going directly to the URL.

    http://www.mysite.com/phpfilename.php?name=username.

    Nextly, you removed the

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

    which means, when AJAX tries to connect to that php file, it will get an error and/or return nothing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There's an overflow-x and overflow-y under 'inline style' you'll have to set.

    It looks like the overflow-y is set to not in use or visible. Try setting the overflow-y to auto or scroll and set the overflow-x to hidden and see if that doesn't produce your expectations.

    That should force the plugin to keep the text inside the element and produce a vertical scroll bar.

  • You changed the sql?

    SELECT id FROM members where username = ?

    SELECT id FROM user where username = ?

    Which is the correct name for the table you're trying to read from?

    What errors are you getting if any? What is the AJAX.LastRequest showing?

  • Ok, does it work?

  • If it's a small set you could use choose.

    choose("This text","That text","The other text")

  • And a quick thank you for posting all those images. Made figuring out the problem SOOO much easier.

  • First, you're loading the json wrong:

    It should be

    -> Array: Load from JSON string AJAX.LastData

    Next, you're trying to get 1 dimensional data from a 2 dimensional array.

    Try this:

    -> Text: Set text to Array.At(1,1)

    That should be "B"

    0,1 should be "b"

    Have a question though, why are you using an array when you can uppercase("b") and get "B"

    You could do a choose("a","b","c"... etc.) to get a random letter, stuff that into a variable and then compare user input to uppercase(variable)

  • Yes. Whether you succeed depends on your skills and knowledge.

  • You realize that a 2pt font would be so tiny as to be unreadable?

    https://www-archive.mozilla.org/newlayout/testcases/css/sec526pt2.htm

    2pt is the second one from the top.

    That is this reply in 2pt as seen by Chrome. So, Chrome does do 2pt.

  • Have you looked at the HTMLElement plugin?

    construct.net/en/make-games/addons/190/html-element

  • Exactly what I was trying to say. I just used wayyyy to many words.

  • I see what you're wanting to do.

    I assume you have these tiles as some sort of grid. What you'll need to do is to do something like a for loop. You'll have look at the grid the tile was placed on, then look at the grids x-1, y-1 to x+1, y+1 and see if there are any other conveyors on those grids and change your sprite depending on where the other conveyors are.

    But, you have other problems. What if a player puts down a conveyor like this

    0X0

    X0X

    0X0

    Where x are conveyors and 0 are empty.

    Now, what if the player places the next one in the middle of that grid?

    My suggestion is to 'guess' at what the player wants but also give them the ability to rotate the conveyors.

    The easiest solution:

    Have straight conveyors and curved conveyors. Allow the user place whichever they want and give them the ability to click on those conveyors to 'reverse' direction and click another place to rotate them.

    One thing to consider, and this comes from a game TerraTech which also uses conveyors, when they click to reverse, it reverses all connected conveyors.

    *edit

    Still thinking about it, you're also going to need some way to determine which ends of those conveyors will be able to 'connect' to others. For example, a straight conveyor can connect to y-1 and y+1. If it gets rotated then it's x-1, x+1. Curved might be y-1, x+1.