Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

PHP MySQLi

Name: DOMMIT FRONK 2013-02-16 17:20

   
$username = $_POST['username'];
    $pass = $_POST['password'];
   
    //Connect to MySQL
    $mysqli = new mysqli("localhost", "username", "password", "databasename");
    if ($mysqli->connect_errno)
        echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
   
    //Validate user
    $query = "SELECT Hash, Salt FROM USERS WHERE UserName = ?";
    $stmt = $mysqli->prepare($query);
    $stmt->bind_param('s', $username);
    $stmt->execute();
    $stmt->bind_result($userHash, $userSalt);
    $stmt->close();
        $mysqli->close();


I use pretty much the exact same format to perform inserts into this table (which works just fine), but for some reason $userHash and $userSalt always end up null, what gives? D:

This is the beginning of my validation upon login, which is hard to do when the select query isn't giving me anything >_<

Name: Anonymous 2013-02-16 17:33

Read the fucking documentation. What do you think bind_result does? Hint: it's not fetch data.

This isn't Stack Overflow.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List