php - Strange results with mysqli_stmt_bind_result -
i using prepared statement query database astronomical magnitude value
$mid = $_get["mid"]; $stmt = mysqli_prepare($mysqli, 'select eid, band, value, error, notes mags id=?'); mysqli_stmt_bind_param($stmt, "i", $mid); mysqli_stmt_execute($stmt); mysqli_stmt_bind_result($stmt, $eid, $band, $value, $error, $notes); mysqli_stmt_fetch($stmt); mysqli_stmt_close($stmt);
i display results on html page. $value displays 12.345000267029 though value in database 12.345. ideas why happening?
if use regular query (i.e. not prepared statement) value displays correctly.
$query = "select eid, band, value, error, notes mags id=$mid"; $res = mysqli_query($mysqli,$query); while ($row = mysqli_fetch_assoc($res)) { $eid = $row["eid"]; $band = $row["band"]; $value = $row["value"]; $error = $row["error"]; $notes = $row["notes"]; }
Comments
Post a Comment