php - Android failed to connect to database -


i new in android, wanna connect android app mysql database via php (i use mamp-pro create database). don't know why response failed. in php file, insert new record in database table, doesn't add new record database. here code:

okhttpclient client = new okhttpclient();     file cachedirectory = new file(this.getcachedir(),"http");     int cachesize = 10 * 1024 * 1024;     cache cache = new cache(cachedirectory, cachesize);     client.setcache(cache);     request request = new request.builder().url("http://localhost:8888/myfirstphp.php").build();      client.newcall(request).enqueue(new callback() {         @override         public void onfailure(request request, ioexception e) {             updatetextview1();         }          @override         public void onresponse(response response) throws ioexception {             if (response.code() >= 200 || response.code() <= 300){                 responsebody responsebody = response.body();                 inputstream inputstream = responsebody.bytestream();                 updatetextview();             }          }     }); 


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -