I'm trying to secure my database from SQL-injections and I can't seem to make this statement to work. I've done this a few times already and those attempts work but not this one.
$stmt = $db->prepare("SELECT name, pass, email FROM users WHERE salt=?");
$stmt->bind_param("s", $salt);
$stmt->execute();
$stmt->bind_result($stuff1,$stuff2,$stuff3);
$stmt->store_result();
while ( $stmt->fetch() ) {
var_dump($stuff1." - ".$stuff2." - ".$stuff3."<br />");
}
$stmt->free_result();
$stmt->close();
I've managed to get that it works all the way to execute by placing var_dumps but I don't get why the results/fetch don't work. Is there a simple explanation to what I've missed?
EDIT: What I'm expecting is to retrieve name, pass and email from my table but instead I just get NULL.