Return JSON from MySQL with Column Name
You should use mysqli_fetch_assoc here instead so that it returns the key as the column names. mysqli_fetch_row returns numeric array keys instead.
Try this:
if (mysqli_num_rows($result) > 0) { $jsonData[] = mysqli_fetch_assoc($result);}$json = json_encode($jsonData, JSON_PRETTY_PRINT);