Search code examples
javaphpmysqlstring-parsing

Mysql->PHP->Java - How to avoid losing information in strings?


I am trying to make an android app, and I am using some userbased input from mysql. I output it with php and load it with java.

There can be plenty of results.

At the moment my output could be.

IDS: 1,4,7,3,9 MSG ffsdf,sdfs,dfsd,fsdfsdf,sdfsfd

But if people write a , or or something in their text my code will fail.

Any ideas what I can do?


Solution

  • I wouldn't use this approach (delimiters). why don't you create separate variable for each item (easy to do via XML in android). This way you have a better control, there's no need to parse anything and you can easily add validations!