Fengist's Forum Posts

    Thanks for the update guys. As I've mentioned numerous times I'm a horrible JS hack so I'm rarely aware of the developments it undergoes. Nice to know you guys are already well into that ball-game. Google fed me that news this morning and I thot, humm... never heard of that before. Might be something new. Guess not. The way it sounds now, it was just a big publicity stunt for ebay.

    One of the biggest problems with web-based applications is speed. Languages like PHP are compiled by the server each time they're called (yes, the compiled bytecode is cached for speed). JS is compiled by the browser on the end user's computer each time they're called (which I assume is also cached).

    But imagine if you could compile your Construct app into an executable with assembly-like speed.

    https://www.techrepublic.com/article/replacing-javascript-with-webassembly-how-ebay-made-a-web-app-50x-faster-by-switching-programming-languages/

    This may be a long way off yet but...

  • What's the exact user name you're looking for?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Over the years I've worked with a lot of IDE's. One of the best is Delphi. It's called a RAD (Rapid Application Development) platform. One of the ways it makes things really easy to work with is something called panels. You can drop these panels on a form (layout) and give them various alignments, like top, left, bottom, center or even custom alignments. When you drop components (objects) onto them, they have anchors and they anchor themselves to the panels. You can set the anchors to any combination of top, bottom, left or right. The beauty of this is, as the form gets resized, the panels automatically resize based on their alignment and the components anchored to them stay in a position relative to their anchor setting. A top alignment will adjust it's width but not it's height, to match the form size. Left aligns, adjust height, but not width. Panels and anchors are an almost fool-proof way of developing aps and having all of the components stay exactly where you want them, regardless of the size of the form.

    That... is something I desperately miss in C3. Call them containers or what you wish, C3's methods for layout placement always forces me to manually place things exactly where I want them in the onStart and browser resize events. And to me, that's pretty clunky.

  • As for price there's two ways to do it.

    1. You make a FANTASTIC plugin that saves users TONS of time or gives them features they can't get anywhere else and charge a lot for it or.

    2. Bubblegum. You make a lot of simple plugins that make life easy and charge a little for each one.

  • It depends. Can the buttons be fully customized with CSS? Can the tooltips be customized with CSS? Can I change the fill and colors of the checkboxes and radio buttons? Are there onHover events and can I change the CSS when the hover event fires?

    Basically, as someone experienced in HTML and CSS can I make them look exactly the way I want, when I want but still make them look good when I don't want to mess with CSS?

    Can you make both noobs and pro's happy?

  • the error now returns:

    No user found with that name.

    That's perfect!

    That means that the username you searched for wasn't in the database. That's good because it means there were no errors. You connected to the database, you performed a query but it returned 0 results.

    Now, all you have to do is add a user to the database and search for them.

    Binding params is relatively new to php. It's purpose is to prevent things like SQL injection when getting query strings like $_GET. Basically, the way it works is this.

    In your query you substitute the ? for the insecure variables you want to put in the query.

    You then prepare the query. Then you bind the variables to the query. In the bind_param the 's' simply tells the bind command that you're passing a string and it substitutes the first ? (which it now knows is a string) for the $_GET["name"]. If you have say 3 ?'s in your query:

    SELECT id from user where username = ? and birthday = ? and country = ?

    $stmt->bind_param("sss", $_GET["username"], $_GET["birthday"], $_GET["country"])

    Then, you execute the query and finally get the results.

    Very glad you got it working!

  • Ok, I'm wholly unfamiliar with PDO and how it connects but the error you're getting is because it's failing to make a connection to the database so we need to do some error checking. I'm making a guess that you're using MySQL so let's try establishing a mysql connection instead:

    You currently have the PDO password set to '' which means, you aren't using one. I have yet to see an install of MySQL that allows no password on the root account unless you specifically set it to none.

    In the script below, you're going to need to replace DB_PASSWORD with the password you used when you set up the root account and put it inside single quotes like this:

    'password'

    If you're sure you don't have a password for that database then replace DB_PASSWORD with:

    ''

    Hopefully, this will work. Just run this from the browser. Once it does work, you can add in the:

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

    Back at the top.

    Take note, this produces a string as the AJAX result. From what I saw you had the result set to a number. If this does work, you will need to change it to see the errors.

    <?php
    $base = new mysqli('localhost', 'root', DB_PASSWORD, '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';
    }
    ?>
    
  • 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.

  • 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")