AsyncHttpClient not passing the value to php - php

Hi i am using php to connect my android app to mysql but the get method is not passing the value to the php file.
This is my code.
private void executeAjaxRequest(){
String url = mDataUrl+"?request="+mRequest+"&outlet_id="+mOutletID;
Log.v("url",url);
System.out.println("This is StoreActivity " +url);
AsyncHttpClient httpclient = new AsyncHttpClient();
httpclient.get(url, new AsyncHttpResponseHandler() {
#Override
public void onSuccess(String response) {
setOutletData(response);
Log.i("TAG",response);
}
});
}
It should pass the outletid and mrequest to the php file to get the data from the database.
Can you tell me where i am going wrong.
error_reporting(0);
//$url = $_GET['url'];
$mR = $_GET["mRequest"];
$mOid = $_GET["mOutletID"];
//$mloc = $_GET['mLocation'];
//connect to the db
//echo $mOid;
$user = "root";
$pswd = "";
$db = "recommendations_db";
$host = "localhost";
$conn = mysql_connect($host, $user, $pswd);
mysql_select_db($db);
//if($mR == 'outlets' && $mloc = 'all'){
$query = "SELECT outlet_id,outlet_name,outlet_location,outlet_image FROM outlets WHERE outlet_id = '$mOid'";
$result = mysql_query($query) or die("Unable to execute query because : " . mysql_error());
//echo $result ." ". $mOid;
while($row = mysql_fetch_assoc($result))
{
$query2 = "SELECT a.item_id,a.item_name,a.item_image FROM items a,outlets b,recommendations c WHERE a.item_id = c.item_id AND b.outlet_id = c.outlet_id AND b.outlet_id = ".$row['outlet_id'];
$row['recommended_products']=array();
$result2 = mysql_query($query2) or die("Unable to execute query because : " . mysql_error());
//echo $row;
while($row2 = mysql_fetch_assoc($result2)){
$row['recommended_products'][]=$row2;
//echo $row;
}
$output[] = $row;
}
print( json_encode($output) );
mysql_close($conn);

Are you able to retrieve the request and outletid on your server ? If the request is indeed and SQL request it should be url encoded to avoid truncating the URL with some potentially "dangerous" characters.
You should override the method onFailure from AsyncHttpResponseHandler to handle any possible error. What you could also try is to use the RequestParams instead of putting the parameters and their values in the URL. You can use them like so:
RequestParams params = new RequestParams();
params.put("request", "mRequest");
params.put("outlet_id", "mOutletID");
AsyncHttpClient client = new AsyncHttpClient();
client.get("URL", params, new AsyncHttpResponseHandler() {
#Override
public void onFailure(Throwable arg0, String arg1) {
// Handle the error
}
#Override
public void onSuccess(String arg0) {
// Do stuff with the result
}
});

Related

Receive Json data POST method in PHP server from Android using Volley Library

Hello I'm send an JSON object from android using volley library. I can not receive this JSON object in PHP. I checked by echo ING my JSON data I can see the object in my 'OnResponse Method'. It would be my pleaser if anyone can help me to solve it. I'll owe you a great debt. Here is my code ->
Android Volley Code ->
private void registerUser() {
JSONObject postObject = new JSONObject();
RequestQueue queue = Volley.newRequestQueue(this);
JSONObject historyObject = new JSONObject();
String url ="http://helpinghandbd.org/app/index.php";
try {
//historyObject.put("id","1");
historyObject.put("email","1234");
historyObject.put("password","1234");
postObject.put("user",historyObject);
} catch (JSONException e) {
e.printStackTrace();
}
Log.e("LoginActivityJsonObject",""+postObject);
JsonObjectRequest objRequest = new JsonObjectRequest(Request.Method.POST, url,postObject,
new Response.Listener<JSONObject>() {
#Override
public void onResponse(JSONObject response) {
Log.e("LoginActivity","OnResponse: "+response);
Toast.makeText(LoginActivity.this, String.valueOf(response), Toast.LENGTH_LONG).show();
}
}, new Response.ErrorListener() {
#Override
public void onErrorResponse(VolleyError error) {
Log.e("OnError", String.valueOf(error.getMessage()));
}
});
queue.add(objRequest);
}
JSON Format is ->
{ 'user':{
'email':'1234',
'password':'1234'
}
}
And Finally PHP Code is ->
<?php
$data = file_get_contents("php://input");
//echo $data; -> //{ 'user':{'email':'1234','password':'1234'}};
$decode = json_decode($data,true);
$email = $decode->user['email'];
$password = $decode->user['passowrd'];
$servername = "localhost";
$username = "helpinghandbd_app";
$password = "Demopass000";
$dbname = "helpinghandbd_app";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//$data = file_get_contents("php://input");
//{ 'user':{'email':'1234','password':'1234'}};
$sql = "INSERT INTO users (id,email,password)
VALUES (null, '$email', '$password')";
if ($conn->query($sql) === TRUE) {
echo $data;
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>
I can not receive JSON Object in PHP. Thanks in advance.
In your php code, change
$decode = json_decode($data,true);
$email = $decode->user['email'];
$password = $decode->user['passowrd'];
to
$decode = json_decode($data,true);
$email = $decode['user']['email'];
$password = $decode['user']['passowrd'];

Select data from MySQL using android volley post request and display it in recyclerview

What I want is that when someone(user) click's a button on main activity two values will be send to the php file with the help of volley POST request, say minvalue and maxvalue, and it will select the data accordingly from mysql database.
Here's my code for POST request:
public void FilterPower(View view) {
StringRequest stringRequest = new StringRequest(Request.Method.POST, Config.DATA_URL,
new Response.Listener<String>() {
#Override
public void onResponse(String response) {
/*Some Method*/
/*Display data in recyclerview*/
//Initializing Views
recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
layoutManager = new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
//Initializing our superheroes list
listSuperHeroes = new ArrayList<>();
//Calling method to get data
getData();
/*End Display data in recyclerview*/
/*End Some Method*/
}
},
new Response.ErrorListener() {
#Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(MainActivity.this, error.toString(), Toast.LENGTH_LONG).show();
}
}) {
#Override
protected Map<String,String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("minvalue", "1000");
params.put("maxvalue", "2000");
return params;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
requestQueue.add(stringRequest);
}
}
My Php File Code:
<?php
$con = mysqli_connect("127.0.0.1","superinfoadmin","","superhero");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if($_SERVER['REQUEST_METHOD']=='POST'){
$minvalue = $_POST['minvalue'];
$maxvalue = $_POST['maxvalue'];
$result = mysqli_query($con, "SELECT * FROM superinfo, publisher WHERE superinfo.s_publisherid=publisher.p_id AND (s_power BETWEEN $minvalue AND $maxvalue)");
//$result = mysqli_query($con, "INSERT INTO testDB (min, max) VALUES ('$minvalue', '$maxvalue')");
while($row = mysqli_fetch_assoc($result))
{
$output[]=$row;
}
print(json_encode($output));
mysqli_close($con);
}
?>
When I try running my app using above code no data is selected and displayed in recyclerview.
But when I try Inserting values in the database using same variable then the values are inserted.
I even tried keeping both select and insert statement to check whether it enters the "IF" loop, and yes it does enters and insert the values in DB but does not executes select statement.
However if I give an else statement to select all data and display it in recyclerview it works properly, so there's no problem in displaying the data in recyclerview the code works fine. Below is the same PHP code with else statement:
if($_SERVER['REQUEST_METHOD']=='POST'){
$minvalue = $_POST['minvalue'];
$maxvalue = $_POST['maxvalue'];
$result = mysqli_query($con, "SELECT * FROM superinfo, publisher WHERE superinfo.s_publisherid=publisher.p_id AND (s_power BETWEEN $minvalue AND $maxvalue)");
//$result = mysqli_query($con, "INSERT INTO testDB (min, max) VALUES ('$minvalue', '$maxvalue')");
while($row = mysqli_fetch_assoc($result))
{
$output[]=$row;
}
print(json_encode($output));
mysqli_close($con);
}
else{
$result = mysqli_query($con, "SELECT * FROM superinfo, publisher WHERE superinfo.s_publisherid=publisher.p_id");
while($row = mysqli_fetch_assoc($result))
{
$output[]=$row;
}
print(json_encode($output));
mysqli_close($con);
}
Please Help I don't know what I'm doing wrong or what I'm not doing.
I don't see any problem in your code but check this if you get any output please inform me
<?php
$con = mysqli_connect("127.0.0.1","superinfoadmin","","superhero");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if($_SERVER['REQUEST_METHOD']=='POST'){
$minvalue = $_POST['minvalue'];
$maxvalue = $_POST['maxvalue'];
$sql="SELECT * FROM superinfo, publisher WHERE
superinfo.s_publisherid=publisher.p_id AND s_power BETWEEN '$minvalue' AND
'$maxvalue'";
echo $sql;
$result = mysqli_query($con,$sql);
$output=array();
$output = mysqli_fetch_assoc($result);
print(json_encode($output));
mysqli_close($con);
}
?>

Posting JSON file on a PHP file from Android Application, and decoding JSON to local variables on PHP

I have been researching this for a while now and not getting anywhere.
What I'm trying to do is to create a registrion/login activities, which will store all access details on a remote SQL database.
My outline of the code was to create the "Registrar" object, convert it to JSON object, and convert that JSON object to a string, and then send that string over httpclient as a post to the PHP page ( which is located on my XAMPP ), kindly take note that I'm using Android Studio Emulator.
My problem:
I don't know if the JSON file is received by the PHP server or not.
Here is my code:
Submit function:
public void goSubmit(View view) throws IOException {
EditText nameEdit = (EditText) findViewById(R.id.nameEdit);
EditText idEdit = (EditText) findViewById(R.id.idEdit);
String name = nameEdit.getText().toString();
String ID = idEdit.getText().toString();
//Creating Student (Registrar) Object
Student registrar = new Student();
registrar.setMajor(majorEdit);
registrar.setName(name);
registrar.setId(ID);
//Creating JSON String
String registrarJSON = null;
try {
registrarJSON = ObjInJSON(registrar);
Toast.makeText(this, registrarJSON, Toast.LENGTH_LONG).show();
} catch (JSONException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//Posting JSON String on Remote PHP
String PHPresponse = sendToRegistrationPHP(registrarJSON);
Toast.makeText(this, PHPresponse, Toast.LENGTH_LONG).show();
//Receive PIN from PHP as JSON String
//Parsing JSON string to integer (pin)
//Set PIN in registrar.getpin()
//Passing the object to setPassword Activity condition registrar.pin =! null
}
Student class:
public class Student {
String Id = "NULL" ;
String Major = "NULL";
String Name = "NULL";
String Password = "NULL";
String Pin = "NULL";
public String getPin() {
return Pin;
}
public void setPin(String pin) {
Pin = pin;
}
public String getPassword() {
return Password;
}
public void setPassword(String password) {
Password = password;
}
public String getId() {
return Id;
}
public String setId(String id) {
Id = id;
return id;
}
public String getName() {
return Name;
}
public void setName(String name) {
Name = name;
}
public String getMajor() {
return Major;
}
public void setMajor(String major) {
Major = major;
}
}
Creating JSON object in string format:
protected String ObjInJSON(Student studentC) throws JSONException, UnsupportedEncodingException {
String ID = studentC.getId();
String Pin = studentC.getPin();
String Major = studentC.getMajor();
String Password = studentC.getPassword();
String Name = studentC.getName();
JSONObject json_obj = new JSONObject();
json_obj.put("id", ID);
json_obj.put("password", Password);
json_obj.put("pin", Pin);
json_obj.put("major", Major);
json_obj.put("name", Name);
return json_obj.toString();
}
Sending to PHP server:
public static String sendToRegistrationPHP(String jarr) throws IOException {
StringBuffer response = null;
try {
String myurl = "10.0.2.2:8070/StudentaccistancePHP/MySqlTEST.php";
URL url = new URL(myurl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(15000 /* milliseconds */);
conn.setRequestProperty("Content-Type", "application/json");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setRequestMethod("POST");
OutputStream out = new BufferedOutputStream(conn.getOutputStream());
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"));
writer.write(jarr);
writer.close();
out.close();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String inputLine;
response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println("Response in universal: " + response.toString());
} catch (Exception exception) {
System.out.println("Exception: " + exception);
}
if (response != null) {
return response.toString();
}
else return "Not WORKING !";
}
PHP server:
<?php
$json = file_get_contents('php://input');
$data = json_decode($json, true);
$ID = $data['id'];
$password = $data['password'];
$pin = "323232";
$major = $data['major'];
$name = $data['name'];
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "studentassictance";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
$sql = "INSERT INTO students (id, major, name, password, pin)
VALUES ('$ID', '$major', '$name', '$password', '$pin')";
if ($conn->query($sql) === TRUE) {
echo "New record created successfully <br>";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
?>
However, nothing is inserted to the database.
First, you need to check what arrives as JSON into PHP side. You can
var_dump($json,$data);
after json_encode() call and watch it to be a valid JSON. You can validate it here
Second, show you SHOW CREATE TABLE students
And third, rewrite everything to PDO as it supports named parameters and it would be theoretically easier for you to migrate to another DB engine later if needed. So it would be something like:
<?php
define('DSN','mysql:dbname=test;host=localhost');
define('DB_USERNAME','testuser');
define('DB_PASSWORD','testpassword');
$connect = new PDO(DSN, DB_USERNAME, DB_PASSWORD);
$json = file_get_contents('php://input');
/*$json = '{
"id": "111",
"password": "sfsdfsdf",
"major": "Math",
"name": "Test User"
}';*/
$data = json_decode($json, true);
$ID = $data['id'];
$password = $data['password'];
$pin = "323232";
$major = $data['major'];
$name = $data['name'];
$sql = "INSERT INTO `students`(`id`,`major`, `name`, `password`, `pin`) VALUES(:id, :major, :name, :password, :pin)";
$result = $connect->prepare($sql);
//bind parameter(s) to variable(s)
$result->bindParam( ':id', $ID, PDO::PARAM_INT );
$result->bindParam( ':major', $major, PDO::PARAM_STR );
$result->bindParam( ':name', $name, PDO::PARAM_STR );
$result->bindParam( ':password', $password, PDO::PARAM_STR );
$result->bindParam( ':pin', $pin, PDO::PARAM_STR );
$status = $result->execute();
if ($status)
{
echo "New record created successfully <br>";
} else
{
echo "Error: <br>" .
var_dump($connect->errorInfo(),$status);
}
$connect = null;

Delete from Mysql (android)

so yesterday it was working fine , all i did today was change the url cause my ip address changes , i dont know what's wrong with it , it says * deleted perfectly* but it actually doesn't delete a thing
here's my php script
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "restaurant";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
//$_POST["sIDCOMMANDES"]=6;
$commandesID = $_POST["sIDCOMMANDES"];
$strSQL = "DELETE FROM commandes WHERE 1 AND ID_COMMANDES = '".$commandesID."' ";
$result = $conn->query($strSQL);
if(!$result)
{
$ar["StatusID"] = "0";
$ar["Error"] = "Cannot delete data!";
}
else
{
$ar["StatusID"] = "1";
$ar["Error"] = "";
}
print(json_encode($ar));
$conn->close();
?>
I ve tested it and it s working fine , now here s my code for deleting a row from my listview
public class ImageAdapter extends BaseAdapter
{
private Context context;
public View getView(final int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
convertView = inflater.inflate(R.layout.get_all_comm_list_view, null);
}
ImageButton cmdDelete = (ImageButton) convertView.findViewById(R.id.btnDelete);
cmdDelete.setBackgroundColor(Color.TRANSPARENT);
final AlertDialog.Builder adb1 = new AlertDialog.Builder(Comm.this);
final AlertDialog.Builder adb2 = new AlertDialog.Builder(Comm.this);
cmdDelete.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
adb1.setTitle("Delete?");
adb1.setMessage("Are you sure delete [" + MyArrList.get(position).get("NOM_PLAT") +"]");
adb1.setNegativeButton("Cancel", null);
adb1.setPositiveButton("Ok", new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String url = "http://192.168.1.7/deleteData.php";
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("sIDCOMMANDES", MyArrList.get(position).get("ID_COMMANDES")));
String resultServer = getJSONUrll(url, params);
String strStatusID = "0";
String strError = "Unknown Status";
try {
JSONObject c = new JSONObject(resultServer);
strStatusID = c.getString("StatusID");
strError = c.getString("Error");
} catch (JSONException e) {
e.printStackTrace();
}
if(strStatusID.equals("0"))
{
adb2.setTitle("Error! ");
adb2.setPositiveButton("Close", null);
adb2.setMessage(strError);
adb2.show();
}
else
{
Toast.makeText(Comm.this, "Delete data successfully.", Toast.LENGTH_SHORT).show();
ShowData(); // reload data again
}
}});
adb1.show();
}
});

HttpPost not working in Android

I am trying to make a HttpPost from my app to a php script, which will then insert data to a remote database. I'm not getting any runtime errors, but the data never gets inserted into my remote database.
Code:
public class InsertResult extends AsyncTask<String, String, String>
{
#Override
protected String doInBackground(String... arg0)
{
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://www.<myDomain>.co.za/insertTeamResultwithCode.php");
try
{
ArrayList<NameValuePair> nameValues = new ArrayList<NameValuePair>(10);
nameValues.add(new BasicNameValuePair("Code", password));
nameValues.add(new BasicNameValuePair("Section", section));
nameValues.add(new BasicNameValuePair("Gender", gender));
nameValues.add(new BasicNameValuePair("WinningTeam", newResult.getWinningTeam()));
nameValues.add(new BasicNameValuePair("LosingTeam", newResult.getLosingTeam()));
nameValues.add(new BasicNameValuePair("FixtureD", newResult.getDate()));
nameValues.add(new BasicNameValuePair("FixtureT", newResult.getTime()));
nameValues.add(new BasicNameValuePair("Venue", newResult.getVenue()));
nameValues.add(new BasicNameValuePair("Court", newResult.getCourt()));
nameValues.add(new BasicNameValuePair("Texts", newResult.getText()));
httppost.setEntity(new UrlEncodedFormEntity(nameValues));
HttpResponse response = httpclient.execute(httppost);
}
catch (ClientProtocolException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
return null;
}
#Override
protected void onPostExecute(String result)
{
GoToJarvisDashboard();
}
}
And PhP script:
<?php
//Code verifications
$Code = $_GET['Code'];
//Variables for SQL INSERT
$Section = $_GET['Section'];
$Gender = $_GET['Gender'];
$WinningTeam = $_GET['WinningTeam'];
$LosingTeam = $_GET['LosingTeam'];
$FixtureD = $_GET['FixtureD'];
$FixtureT = $_GET['FixtureT'];
$Venue = $_GET['Venue'];
$Court = $_GET['Court'];
$Texts = $_GET['Texts'];
$SetsWon = $_GET['SetsWon'];
$SetsLost = $_GET['SetsLost'];
$Winner_Score = $_GET['Winner_Score'];
$Loser_Score = $_GET['Loser_Score'];
$dbname = '<dbName>';
$dbuser = '<user>';
$dbpass = '<password>';
$dbhost = '<host>t';
$connect = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname) or die ("Unable to Connect to '$dbhost'");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$SQL = "SELECT * FROM squasdlw_db1.validationCodes WHERE Code = '$Code'";
$codeValid = mysqli_query($connect, $SQL) or die (mysqli_error($connect));
$response["no"] = array();
if (mysqli_num_rows($codeValid) > 0)
{
echo "Code is valid\n\n";
//Insert Result
$query = "INSERT INTO squasdlw_db1.jarvisTeamResults (Section,Gender,WinningTeam,LosingTeam,FixtureD,FixtureT,Venue,Court,Texts,SetsWon,SetsLost,Winner_Score,Loser_Score) VALUES('$Section','$Gender','$WinningTeam','$LosingTeam','$FixtureD','$FixtureT','$Venue','$Court','$Texts','$SetsWon','$SetsLost','$Winner_Score','$Loser_Score')";
$result = mysqli_query($connect, $query) or die (mysqli_error($connect));
echo "Result successfully submitted to Jarvis Remote Database: Table -> jarvisTeamResults\n\n" ;
//Update Winner on jarvisLogs
$query = "UPDATE squasdlw_db1.jarvisLogs SET Points = Points + '$Winner_Score', Played = Played + 1, Won = Won + 1 WHERE Gender = '$Gender' AND Section = '$Section' AND Team = '$WinningTeam'";
$result = mysqli_query($connect, $query) or die (mysqli_error($connect));
echo "Log update for '$WinningTeam': Table -> jarvisLogs\n\n";
//Update Winner on jarvisLogs
$query = "UPDATE squasdlw_db1.jarvisLogs SET Points = Points + '$Loser_Score', Played = Played + 1, Lost = Lost + 1 WHERE Gender = '$Gender' AND Section = '$Section' AND Team = '$LosingTeam'";
$result = mysqli_query($connect, $query) or die (mysqli_error($connect));
echo "Log update for '$LosingTeam': Table -> jarvisLogs\n\n";
$response["isValid"] = true;
echo json_encode($response);
}
else
{
$response["isValid"] = false;
echo "The code is not valid\n";
echo json_encode($response);
}
mysqli_close($connect);
?>
Whats even weirder is that if I try this in a web browser, it works fine and the data does get added to the remote database-
http://www.<myDomain>.co.za/insertTeamResultwithCode.php?Code=<password>&Section=A&Gender=Men&WinningTeam=NW&LosingTeam=KZN&FixtureD=2015-05-25&FixtureT=09:00:00&Venue=Puk&Court=6&Texts=Andrew%20(NW)%20beat%20Kevin%20(WP)%203-1&SetsWon=15&SetsLost=5&Winner_Score=15&Loser_Score=5
Please help out, I have no idea what is going wrong because it does not create runtime errors? I am about to go crazy...
You are doing an HttpPost so you should get your data via POST and not GET
//Code verifications
$Code = $_POST['Code'];
//Variables for SQL INSERT
$Section = $_POST['Section'];
$Gender = $_POST['Gender'];
$WinningTeam = $_POST['WinningTeam'];
$LosingTeam = $_POST['LosingTeam'];
$FixtureD = $_POST['FixtureD'];
$FixtureT = $_POST['FixtureT'];
$Venue = $_POST['Venue'];
$Court = $_POST['Court'];
$Texts = $_POST['Texts'];
$SetsWon = $_POST['SetsWon'];
$SetsLost = $_POST['SetsLost'];
$Winner_Score = $_POST['Winner_Score'];
$Loser_Score = $_POST['Loser_Score'];
Or change your android code to make GET requests :
HttpGet httpget = new HttpGet("http://www.example.com/insertTeamResultwithCode.php");
You are sending POST in android BUT you are expecting GET in php which are not the same.
Change the $_GET to $_POST and it will work.
Here a post that will tell you difference between then
Here another with some more details

Categories