Hi - I am querying my MySQL database to get values from the database. I think I am close to my solution of having the values returned as names only like this
Master Blaster
George Huff
Frank Tiff
Sam Smith
this is my code, and when the array prints (well besides the no line break) it currently prints like this
["Master Blaster","George Huff","Frank Tiff","Sam Smith"]
How should I change my code so that I get each name on it's own line with no double quotes?
<?php
$dblink = mysqli_connect("website", "user", "pass", "database");
if (mysqli_connect_errno()) {
echo "Could not connect to database: Error: ".mysqli_connect_error();
exit();
}
$sqlquery = "SELECT employee FROM employees LIMIT 10";
if ($result = mysqli_query($dblink, $sqlquery)) {
while ($row = mysqli_fetch_assoc($result)) {
$types[] = $row['employee'];
}
mysqli_free_result($result);
}
mysqli_close($dblink);
print_r(json_encode(array_values($types)));
?>