<?php
$db_name = "....";
$mysql_username = "root";
$mysql_password = "";
$server_name = "192.168.56.1";
$conn = mysqli_connect($server_name, $mysql_username, $mysql_password,$db_name);
$response = array();
// check for required fields
$note_title = "test55";
$note_content = "test88";
// mysql inserting a new row
$result = mysql_query("INSERT INTO notes(note_title, note_content) VALUES('$note_title', '$note_content')");
// check if row inserted or not
if ($result) {
// successfully inserted into database
$response["success"] = 1;
$response["message"] = "Product successfully created.";
// echoing JSON response
echo json_encode($response);
} else {
// failed to insert row
$response["success"] = 0;
$response["message"] = "Oops! An error occurred.";
// echoing JSON response
echo json_encode($response);
}
// required field is missing
$response["success"] = 0;
$response["message"] = "Required field(s) is missing";
// echoing JSON response
echo json_encode($response);?>
what the problem for this php when you put in android studio the note not save in database.we use phpmyadmin,wampserver and put database in localhost .