Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    mysqli free results

    Hello:

    I am new to mysqli and have seen many examples on the internet, but I am struggling with getting mysqli_free_results to work. All the examples I have seen are based on 1 field in the bind results, but because I have 3, in this case, how do I get mysqli_free-results($results) to work?






    PHP Code:
    <?php

    require("dbcon.php");

    // Check for errors
    if(mysqli_connect_errno())
    {
       echo 
    mysqli_connect_error();
    }

    // Create a prepared statement
    if($stmt $mysqli -> prepare ("SELECT id, username, password FROM users WHERE password=?"))
    {
    // Bind parameters s - String, b - Boolean, i - Integer etc
    $password='123';

    $stmt -> bind_param("s"$password);

    // Execute it
    $stmt -> execute();

    // Bind result variables
    $stmt->bind_result($id,$username,$password);

    // Fetch the result of the query
    while($stmt->fetch())
    {
       echo 
    $id ' - ' $password ' - ' $username;
       echo 
    "<br />";
    }

    // Close statement
     
    $stmt -> close();
    }
    // Close connection
    $mysqli -> close();
    ?>

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,316
    Thanks
    23
    Thanked 613 Times in 612 Posts
    There is no mysqli_free-results($results). It's mysqli_free_result($result); No 's'.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •