the query from the application is not being updated , but I can do it manually
this is the url , note if you exucte it , the query will be run
http://justedhak.com/old-files/singleactivity.php?id=1&likes=14
this is the php, i know php needs improvement
$id= intval($_GET['id']);
$likes= intval($_GET['likes']);
$con = mysqli_connect($host,$uname,$pwd,$db) or die(mysqli_error());
echo $id;
$sql1="UPDATE OBJECTS SET LIKES=$likes WHERE ID=$id";
$result = mysqli_query($con,$sql1);
this is the code
class SendPostReqAsyncTask extends AsyncTask<String, Void, String> {
@Override
protected void onPreExecute()
{
Log.e("GetText","called");
}
@Override
protected String doInBackground(String... params) {
String json = "";
try{
RequestBody formBody = new FormEncodingBuilder()
.add("id", "1")
.add("likes", "10")
.build();
Request request = new Request.Builder()
.url("http://justedhak.com/old-files/singleactivity.php")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
if (!response.isSuccessful()) throw new IOException("Unexpected code " + response);
//insert username, password and login true after successful login.
//redirect to main activity
} catch (IOException e){
Log.e("MYAPP", "unexpected JSON exception", e);
}
return "success";
}
I am not getting errors , and the asyctask looks good