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

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -