Note that there are some explanatory texts on larger screens.

plurals
  1. POcan't connect android app to mysql using php the error is with my android code
    text
    copied!<pre><code>import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import android.os.StrictMode; import android.util.Log; import android.widget.EditText; public class login extends Activity { Button button2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); EditText breakfast= (EditText) findViewById(R.id.breakfast) ; EditText lunch = (EditText) findViewById(R.id.lunch); EditText dinner = (EditText) findViewById(R.id.dinner); EditText supper = (EditText) findViewById(R.id.supper); Button button = (Button) findViewById(R.id.button1) ; final String breakf = breakfast.getText().toString(); final String lun = lunch.getText().toString(); final String din = dinner.getText().toString(); final String sup = supper.getText().toString(); button2=(Button)this.findViewById(R.id.button2); button2.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // generate your params: List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(); nameValuePairs.add(new BasicNameValuePair("breakfast", breakf)); nameValuePairs.add(new BasicNameValuePair("Lunch", lun)); nameValuePairs.add(new BasicNameValuePair("Dinner", din)); nameValuePairs.add(new BasicNameValuePair("supper", sup)); // send them on their way try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://blahblah php?$username=caroline$password=scamper"); </code></pre> <p>i have a proper url for their i just blanked it out</p> <pre><code> // httpPost.setEntity(new UrlEncodedFormEntity(nameValueParams)); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }});} //@Override public void onClick(View v) { finish(); System.exit(0); } }); Intent intent = new Intent(Login.this, .class); Login.this.startActivity(intent); //new lister for save start db code their //take info from button with sql @Override public void onClick(View arg0) { // TODO Auto-generated method stub postData(); }); // } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } </code></pre> <p>i know i have some errors in it but i have been changeig it and can't figure why it won't change any help would be greatly appreiciated the php should work i am not getting any info from app</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload