I am selecting data from my database in the following way: As expected I get one row as result and want to extract the lat
and lon
data from it:
$prep_stmt = "SELECT lat, lon FROM members WHERE id = ? LIMIT 1";
$stmt = $mysqli->prepare($prep_stmt);
if ($stmt) {
$stmt->bind_param('i', $user_id);
$stmt->execute();
$result = $stmt->store_result();
if ($stmt->num_rows == 1) {
logC("user exists");
logC("extract lat, lon!");
}
}
I tried using $stmt->fetch()
and extracting it from the $result
variable but without success. What is the proper way to do it?