I have a problem with retrieving data from a database using PHP statements. At the moment the output looks like:
[{"Bez":"Cino"},{"Bez":"Extra"},{"Bez":"Panini"},{"Bez":"And so on"}]
"Bez" is the label of the column and we don't want it to be displayed. We just want to display the cell's contents so it should look like:
[Cino,Extra,Panini,And so on]
The php is:
<?php
$username = "root";
$database = "kaffeehaus";
mysql_connect('localhost', $username);
@mysql_select_db($database) or die("Geht nicht!");
$query = "SELECT Bez FROM kategorie";
$result = mysql_query($query) or die(mysql_error("error"));
$num = mysql_numrows($result);
mysql_close();
$rows = array();
while ($r = mysql_fetch_assoc($result))
{
$rows[] = $r;
}
echo json_encode($rows);
?>