I am working on a flutter app which simply updates and inserts the data into a table I have create a php API script:
if("Sign_Up"==$action){
$email = mysqli_real_escape_string($connect, $_POST['email']);
$phone = mysqli_real_escape_string($connect, $_POST['phone']);
$query = "INSERT INTO driver_details (phone, email)
VALUES('$phone', '$email')";
$results = mysqli_query($connect, $query);
if($results>0)
{
echo "user added successfully";
}
}
and I post the data to the API using this data:
static const ROOT="https://www.example.com/driverapp-apis";
static const _Sign_Up='Sign_Up';
Future signup() async {
var response = await http.post(Uri.parse(ROOT), body: {
"email": emailController.text,
"action":'Sign_Up',
"phone":phoneController.text,
});
}
and I **am able to sccessfully insert data ** what I want to get the insert id of this query and use it for further update ? so anyone can help me how to get insert id into my flutter app?