I am trying to get all the rows from my MySQL database using the following code:
$sql = \"SELECT * FROM myTable\"; $result = $conn->query($sql); while
Using array_map you can call the function, so with the value of each $row you can get the values.
array_map
$row
$sql = "SELECT * FROM myTable"; $result = $conn->query($sql); while($row = $result->fetch_assoc()) { $output[]=array_map("nl2br",$row); } echo json_encode($output);