I am beginner in mysql database. I am trying to create an online database application in android. This is a user registration application. I have tested this app with emulator and it succesfully inserting the entered data into database. At the same time tested this app with a real android device and can't insert the data into the database. Is it possoble to do? How can I do this with the same offline server. I am using wampserver version 2.5. My php code given below
<?php
$servername = "localhost";
$username = "micro";
$password = "micro";
$dbname = "insert_user";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}
$name=$_POST['user'];
$pass=$_POST['pass'];
$email=$_POST['email'];
$flag['code']=0;
$sql = "INSERT INTO user(name,pass,email)VALUES('$name','$pass','$email')";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
}
else
{
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
