Re: [android-developers] Re: problem with sending data from app by volley to mysqli

2016-04-20 Thread VISHAL TIKKU
Try from postman client and analyze the response.

On 20 April 2016 at 10:17, Nizzam Mohd  wrote:

> I also facing the same problem, I already debug and everything looks fine.
> Could it be a server response ?
>
> On Sunday, December 6, 2015 at 6:09:11 PM UTC+8, AbdulMajeed Mohammad
> wrote:
>>
>> Hi,
>>
>> I have problem with sending data from app to mysql by php file, I hope to
>> get some help
>> I don't know also if I did it in right way,
>>
>> contact.java
>>
>> public class Contact extends AppCompatActivity {
>>
>> EditText name,phone,email,subject;
>> Button add;
>> RequestQueue requestQueue;
>> String addUrl = "http://10.0.2.2/alruthea/contact/addcontact.php;;
>>
>> @Override
>> protected void onCreate(Bundle savedInstanceState) {
>> super.onCreate(savedInstanceState);
>> setContentView(R.layout.activity_contact);
>> getSupportActionBar().setDisplayShowCustomEnabled(true);
>> getSupportActionBar().setCustomView(R.layout.actionbar);
>>
>> name = (EditText) findViewById(R.id.contactname);
>> phone = (EditText) findViewById(R.id.contactphone);
>> email = (EditText) findViewById(R.id.contactemail);
>> subject = (EditText) findViewById(R.id.contactsubject);
>> add = (Button) findViewById(R.id.contactsend);
>>
>>
>> requestQueue = Volley.newRequestQueue(getApplicationContext());
>>
>>
>> add.setOnClickListener(new View.OnClickListener() {
>> @Override
>> public void onClick(View view) {
>> StringRequest request = new StringRequest(Request.Method.POST, 
>> addUrl, new Response.Listener() {
>> @Override
>> public void onResponse(String response) {
>>
>> }
>> }, new Response.ErrorListener() {
>> @Override
>> public void onErrorResponse(VolleyError error) {
>>
>> }
>> }) {
>> @Override
>> protected Map getParams() throws 
>> AuthFailureError {
>> Map parameters = new HashMap> String>();
>> parameters.put("name", name.getText().toString());
>> parameters.put("phone", phone.getText().toString());
>> parameters.put("email", email.getText().toString());
>> parameters.put("subject", subject.getText().toString());
>>
>> return parameters;
>> }
>> };
>> requestQueue.add(request);
>> }
>>
>> });
>>
>>
>> }
>>
>> }
>>
>>
>>
>> connection.php
>>
>> >
>> define('hostname','localhost');
>> define('user' , 'root');
>> define('password','');
>> define('databaseName','alruthea');
>>
>> $connect = mysqli_connect(hostname, user, password, databaseName);
>>
>> ?>
>>
>>
>>
>>
>>
>> addcontact.php
>>
>> >
>> if($_SERVER["REQUEST_METHOD"]=="POST"){
>>require 'alruthea/contact/connection.php';
>>createContact();
>>}
>>
>>function createcontact()
>>{
>>global $connect;
>>
>>$name = $_POST["name"];
>>$phone = $_POST["phone"];
>>$email = $_POST["email"];
>>$subject = $_POST["subject"];
>>
>>$query = "Insert into contact(name,phone,email,subject) values
>> ('$name;,'$phone','$email','$subject');";
>>
>>mysqli_query($connect, $query) or die (mysqli_error($connect));
>>mysqli_close($connect);
>>}
>>
>>?>
>>
>>
>>
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Android Developers" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/android-developers/ofI7CeDO9gM/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> android-developers+unsubscr...@googlegroups.com.
> To post to this group, send email to android-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/android-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/android-developers/ad591b4c-999c-4191-a1e5-2cd0b8ce4ca1%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 

[android-developers] Re: problem with sending data from app by volley to mysqli

2016-04-19 Thread Nizzam Mohd
I also facing the same problem, I already debug and everything looks fine. 
Could it be a server response ?

On Sunday, December 6, 2015 at 6:09:11 PM UTC+8, AbdulMajeed Mohammad wrote:
>
> Hi,
>
> I have problem with sending data from app to mysql by php file, I hope to 
> get some help
> I don't know also if I did it in right way,
>
> contact.java
>
> public class Contact extends AppCompatActivity {
>
> EditText name,phone,email,subject;
> Button add;
> RequestQueue requestQueue;
> String addUrl = "http://10.0.2.2/alruthea/contact/addcontact.php;;
>
> @Override
> protected void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
> setContentView(R.layout.activity_contact);
> getSupportActionBar().setDisplayShowCustomEnabled(true);
> getSupportActionBar().setCustomView(R.layout.actionbar);
>
> name = (EditText) findViewById(R.id.contactname);
> phone = (EditText) findViewById(R.id.contactphone);
> email = (EditText) findViewById(R.id.contactemail);
> subject = (EditText) findViewById(R.id.contactsubject);
> add = (Button) findViewById(R.id.contactsend);
>
>
> requestQueue = Volley.newRequestQueue(getApplicationContext());
>
>
> add.setOnClickListener(new View.OnClickListener() {
> @Override
> public void onClick(View view) {
> StringRequest request = new StringRequest(Request.Method.POST, 
> addUrl, new Response.Listener() {
> @Override
> public void onResponse(String response) {
>
> }
> }, new Response.ErrorListener() {
> @Override
> public void onErrorResponse(VolleyError error) {
>
> }
> }) {
> @Override
> protected Map getParams() throws 
> AuthFailureError {
> Map parameters = new HashMap String>();
> parameters.put("name", name.getText().toString());
> parameters.put("phone", phone.getText().toString());
> parameters.put("email", email.getText().toString());
> parameters.put("subject", subject.getText().toString());
>
> return parameters;
> }
> };
> requestQueue.add(request);
> }
>
> });
>
>
> }
>
> }
>
>
>
> connection.php
>
> 
> define('hostname','localhost');
> define('user' , 'root');
> define('password','');
> define('databaseName','alruthea');
>
> $connect = mysqli_connect(hostname, user, password, databaseName);
>
> ?>
>
>
>
>
>
> addcontact.php
>
> 
> if($_SERVER["REQUEST_METHOD"]=="POST"){
>require 'alruthea/contact/connection.php';
>createContact();
>}
>
>function createcontact()
>{
>global $connect;
>
>$name = $_POST["name"];
>$phone = $_POST["phone"];
>$email = $_POST["email"];
>$subject = $_POST["subject"];
>
>$query = "Insert into contact(name,phone,email,subject) values 
> ('$name;,'$phone','$email','$subject');";
>
>mysqli_query($connect, $query) or die (mysqli_error($connect));
>mysqli_close($connect);
>}
>
>?>
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/ad591b4c-999c-4191-a1e5-2cd0b8ce4ca1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] Re: problem with sending data from app by volley to mysqli

2015-12-07 Thread VISHAL TIKKU
Hi Abdul
Firstly check whether your controller is getting the request if yes then go 
through your log to check if there is some syntax error in query while 
inserting into table.

On Monday, December 7, 2015 at 4:41:14 PM UTC+5:30, AbdulMajeed Mohammad 
wrote:
>
> any help please

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
To post to this group, send email to android-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/78b42273-5860-4a1c-9b19-d6256aa2da15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.