i know type of question has been asked couple of times problem little bit different , can't figure out of fix this. i've checked other similar questions couldn't find solution since seems correct.
i have database table named kalkanlimekanlar , has 3 tables inside it. right now, want encode contents of mekanlar table. has 5 columns , 22 rows inside it.
when run following php code, see no result. i'd grateful if can me this.
i don't know if helps server on digitalocean.
thank help!
php code:
$sql = "select * mekanlar"; $result = mysqli_query($connection, $sql) or die("error in selecting " . mysqli_error($connection)); $emparray[] = array(); while($row =mysqli_fetch_assoc($result)) { $emparray[] = $row; } echo json_encode($emparray); mysqli_close($connection); thank help!
after doing @rhinodevel's suggestion, this
while($row =mysqli_fetch_assoc($result)) { array_push($emparray,$row); } edit : following comments rhino,
$array[] = array (); ($i = 0 ; $i < 5 ; $i++) { $array[] = $i; } $logger->info("op : " . json_encode($array)); $array = array (); ($i = 0 ; $i < 5 ; $i++) { $array[] = $i; } $logger->info("rd : " . json_encode($array)); $array = array (); ($i = 0 ; $i < 5 ; $i++) { array_push($array , $i); } $logger->info("yl : " . json_encode($array)); yields :
2015-07-17t06:59:42-04:00 testpatient.api info op : [[],0,1,2,3,4] 2015-07-17t06:59:42-04:00 testpatient.api info rd : [0,1,2,3,4] 2015-07-17t06:59:42-04:00 testpatient.api info yl : [0,1,2,3,4]
Comments
Post a Comment