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
    7
    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. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    6,328
    Thanks
    30
    Thanked 870 Times in 868 Posts
    There is no mysqli_free-results($results). It's mysqli_free_result($result); No 's'.
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.


 

Posting Permissions

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