Saturday, 15 May 2010

java - sending data from android to mysql database -


Hi im trying to send data from Android device to mysql database. IM phones and laptops are connected to the internet through WiFi My phone is connected to a laptop via USB cable. I am not using emulator. In my Java code I use my 10.0.0.2 and 127.0.0.1 Tried to do or did any work. I have read something on the stack overflow and I understand that they only work on the emulator when I input some data into the app and click on send button, it says that the data was successfully entered and no An error was not registered, but when I check the database, there is no entry. I think the im or my linker.php file is located in the wrong location using the wrong address, then I tried to use my IP ADDRESS. I have main activity in my java code.

  http post httpPost = new HttpPost ("http: // 'IP address / linker.php");  

I changed the Apache http.config, so now its line is

  'Listen to IP address'  
< P> I have internet permissions in the manifest.

  & lt; Use-permission Android: name = "android.permission.INTERNET" & gt; & Lt; / Usage-permission & gt;  

This is my linker.php which is located inside of my HT docs folder

   

In the browser, I linker.php I open the file, I see it. I should check this before I fix it.

  Notice: Undefined index: In Name C: \ xampp \ htdocs \ linker. Notice on php line 6: Undefined index: C: \ xampp \ htdocs \ Linker.php at line  

Any help would be greatly appreciated.

OK, okay? It seems that $ '_POST does not have' name 'and' age '. I have to make a print_a ($ _ POST) as the first acting statement, to see what $ _POST is included ...

Second, the query is a bit far away ... Try

  mysql_query ("Insert in mytable (name, age) value ('$ name', '$ age')") ;  

No comments:

Post a Comment