Hey i am trying to add my selected resultset into an array to send it as a response to my angularjs function
this is my code
include 'dbconnect.php';
global $mysqli;
$sql = "SELECT `id`, `name`, `stock`, `pzn` FROM `pda_articles`";
$result = mysqli_query($mysqli, $sql) OR die(mysqli_error($mysqli));
$data = array();
if($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$data[] = $row;
}
print json_encode($data);
} else {
echo "no";
}
$data[] = $row should work but it doesnt.. $data[] = $row['id'] works but i have no idea how to add the other columns...
maybe you could help me
this is my output with console.log
Thanks :)