I'm trying to insert a row into a table using the following PHP code:
$sql = "INSERT INTO `user_sessions`(`email`, `ip_address`, `location`, `lat`, `lng`, `device_type`, `device_imei`, `login_date`, `login_time`, `active`) VALUES (?,?,?,?,?,?,?,?,?,?);";
$stmt2 = mysqli_stmt_init($con);
if(!mysqli_stmt_prepare($stmt2, $sql)){
$data['result'] = "SQL error";
echo json_encode($data);
exit();
} else {
mysqli_stmt_bind_param($stmt2, "sssddsssss", $email, $ip, $city, $lat, $lng, $user_device, $user_device_imei, $user_date, $user_time, "1");
mysqli_stmt_execute($stmt2);
$data['result'] = "login success";
$data['user_id'] = $row['user_id'];
echo json_encode($data);
exit();
}
I keep getting response code 500 which is a server internal error based on my research
- I'm using a remote server.
- This is a small part of my login.php script which works just fine when this section is commented out.
- $lat and $lng are floats and have a type of float(23,19) in my database.
Any suggestions?