I try to insert data from android app into mysql database on cpanel using web server. I test the code from postman, data inserted to the db, but when i try to use the app, data can't insert. then i try use a 000webhost cpanel as a server, it works there. What should i do?
sorry my english is not good
Insert data to mysql
if($_SERVER['REQUEST_METHOD']=='POST'){
include ('koneksi.php');
$seri = $_POST['seri'];
$tipe = $_POST['tipe'];
$spinner = $_POST['spinner'];
$kelurahan = $_POST['kelurahan'];
$kecamatan = $_POST['kecamatan'];
$kota = $_POST['kota'];
$kode = $_POST['kodepos'];
$sql = "INSERT INTO manual (seri, tipe, spinner, kelurahan, kecamatan, kota, kodepos)
VALUES ('$seri', '$tipe', '$spinner', '$kelurahan', '$kecamatan', '$kota', '$kode');";
if (mysqli_query($con, $sql)) {
echo "Data berhasil disimpan";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($con);
}
mysqli_close($con);
}