Only first word of two strings gets added to db
Posted
by
dkgeld
on Stack Overflow
See other posts from Stack Overflow
or by dkgeld
Published on 2013-10-21T21:51:34Z
Indexed on
2013/10/21
21:53 UTC
Read the original article
Hit count: 156
When trying to add words to a database via php, only the first word of both strings gets added.
I send the text via this code:
public void sendTextToDB() {
valcom = editText1.getText().toString();
valnm = editText2.getText().toString();
t = new Thread() {
public void run() {
try {
url = new URL("http://10.0.2.2/HB/hikebuddy.php?function=setcomm&comment="+valcom+"&name="+valnm);
h = (HttpURLConnection)url.openConnection();
if( h.getResponseCode() == HttpURLConnection.HTTP_OK){
is = h.getInputStream();
}else{
is = h.getErrorStream();
}
h.disconnect();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d("Test", "CONNECTION FAILED 1");
}
}
};
t.start();
}
When tested with spaces and commas etc. in a browser, the php function adds all text. The strings also return the full value when inserted into a dialog.
How do I fix this?
Thank you.
© Stack Overflow or respective owner