Kettlewell's Forum Posts

  • I've learned how to use AJAX, PHP and MySql to return database values but how do you handle multiple values?

    Does AJAX.lastvalue return an array or is there something I have to do to receive multiple values?

    In PHP do I have to do something special or simply;

    echo $var1
    echo $var2[/code:2vyw9z40]
  • AJAX is now operating but the script is returning

    Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home/cluster-sites/2/o/ouroboros-development.co.uk/public_html/login.php on line 17[/code:2n7e4n8h]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • https:// www scirra com /tutorials/525/simple-login-using-a-mysql-database

    I've been learning as I go along and I've put in plenty of error checks.

    The php script does run and it does connect but the query always returns

    RESULT = END OF RESULT[/code:3s9n1l5m] inside of it but If I run SQL straight in phpmyadmin with the exact same query (Minus the variable = ) then I get a good result of IsMember 1.
    
    I'll look into the AJAX possible issue.
    
    [b]*An AJAX error is occurring as you stated it may[/b]
  • I'm following this login tutorial which uses PHP, AJAX and Mysql (Sorry can't post URLs due to reputation) but my results aren't coming out as I expected and I wondered if someone could assist.

    Login.php located at

    <?php
    $email = $_GET['femail'];
    $password = $_GET['fpass'];
    $con=mysqli_connect("mysql2.clusterdb.net","UserD-1i1","*snipped password*");
    // Check connection
    if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
    $qz = "SELECT IsMember FROM PlayerLoginData where EmailID='".$email."' and PassID='".$password."'"; 
    $qz = str_replace("\'","",$qz); 
    $result = mysqli_query($con,$qz);
    while($row = mysqli_fetch_array($result))
      {
      echo $row['IsMember'];
      }
    mysqli_close($con);
    ?>[/code:9vz7otb2]
    
    [b]Database details [/b]- Database and database login are the same as default
    [img="http://i.imgur.com/P1fh41q.png"]
    
    [b]Construct 2 Settings[/b] - I was told AJAX returns a string after I attempted to return a [i]tinyint[/i] from the database so I changed it to a [i]string[/i].
    [img="http://i.imgur.com/onLkmxw.png"]
    
    [b]Results[/b] - As an [i]int [/i]I got [b]NaN[/b] in the IsMember after attempting to login but as a string I receive a blank string.
    AJAX last data is also blank.
    
    [b]*With some error checking I have been given this error[/b]
    [code:9vz7otb2]Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home/cluster-sites/2/o/ouroboros-development.co.uk/public_html/login.php on line 15[/code:9vz7otb2]
    
    Thank you for any help that any help I receive.