java - PHP retrieval from database on single string -


i'm retrieving data sql database these lines of code

$username = $_post['username']; $selector = "select * client_table salesmanid ='" . $username . "';"; $result = mysqli_query($con,$selector);  while($row = mysqli_fetch_array($result)) {     echo  $row['id'] . "/" . $row['name'] .  "/" . $row['address'] .  "/" . $row['zip code'] .  "/" . $row['salesmanid'];     echo "\\r\\n"; } ?> 

on java side do

while ((bufferedstrchunk = bufferedreader.readline()) != null) {     stringbuilder.append(bufferedstrchunk); }  string queryresult = stringbuilder.tostring(); 

and problem when do

string[] results=queryresult.split("\n"); 

the string not split. please help?

you not adding line separator stringbuilder when retrieving data bufferedreader like

stringbuilder.append(bufferedstrchunk).append(system.lineseparator()) 

anyway if want lines in sort of collection can use

list<string> lines = files.readalllines(paths.get("pathtofile")); 

in case of bufferedreader can use (since java 8)

list<string> lines = br.lines().collect(collectors.tolist()); 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -