I am trying to clarify the difference between $stmt->close() and $stmt->free_result() when finalizing a prepared mysqli statement.
So far I use:
$mysqli = new mysqli(host,user,password,database);
$stmt = $mysqli->prepare(sql statement);
[...]
$stmt->free_result();
$mysqli->close();
and everything seems to work fine.
But I've seen a lot of programmers use $stmt->close instead of $stmt->free_result(). And once I've seen both of them:
$stmt->free_result();
$stmt->close();
$mysqli->close();
So what should I choose, under which circumstances and why?