Friday, 16 August 2013

Performance or security differences between mysqli get_result and bind_result?

Performance or security differences between mysqli get_result and
bind_result?

Whats the point for php developer to create function bind_result, as it
seems get_result work fine too.
if($stmt=$mysqli->prepare("SELECT member_ID FROM members where hair=? and
hand=?")){
if($stmt->bind_param('ss',$hair,$hand)){
if($stmt->execute){
$result=$stmt->get_result();
while($line=$result->fetch_assoc()){
echo $line['member_ID'];
}
// ------------ versus -------------------
// $stmt->store_result();
// $stmt->bind_result($member_ID);
// while($stmt->fetch()){
// echo $member_ID;
// }
}
}
}
It seems that (I'm guessing) php developer themselves prefer
$stmt->fetch() since this function came out earlier, but why
$stmt->fetch()? It don't seem to be reason of variable name difference
between $row['member_ID'] and $member_ID.

No comments:

Post a Comment