Mysql Ausgabe in Array
Thomas
- datenbank
Hallo zusammen, ich dabei ein kleines Script zu basteln.
Dabei bin ich auf folgendes Problem gestossen.
Ich habe ein Script, mit dem man per PHP Diagramme darstellen lassen kann. Das kalppt auch alles ganz guet. Nun wollte ich aber die Werte aus einen Datenbank(MySql) nehmen.
<?php
require_once 'phplot.php';
$data = array(
--------->
array('24.12', 5), array('24.12', 5), array('24.12', 5), array('24.12', 5),
<------------------
);c
$plot = new PHPlot(1000, 400);
$plot->SetImageBorderType('plain');
$plot->SetPlotType('bars');
$plot->SetDataType('text-data');
$plot->SetDataValues($data);
# Let's use a new color for these bars:
$plot->SetDataColors('magenta');
# Force bottom to Y=0 and set reasonable tick interval:
$plot->SetPlotAreaWorld(NULL, 0, NULL, NULL);
$plot->SetYTickIncrement(10);
# Format the Y tick labels as numerics to get thousands separators:
$plot->SetYLabelType('data');
$plot->SetPrecisionY(0);
# Main plot title:
$plot->SetTitle('Besucherzahlen im Dezember');
# Y Axis title:
$plot->SetYTitle('Besucherzahlen');
# Turn off X tick labels and ticks because they don't apply here:
$plot->SetXTickLabelPos('none');
$plot->SetXTickPos('none');
$plot->DrawGraph();
?>
Nun sollten die Daten ersezt werden die bei den Pfeilen sind, also das '24.12', 5.
Ich hoffe das Problem ist verständlich.
Lg
Hallo Thomas,
Nun sollten die Daten ersezt werden die bei den Pfeilen sind, also das
Ich hoffe das Problem ist verständlich.
ich sehe kein Problem. Wo ist es?
[ ] Formulierung der Abfrage für die Daten?
[ ] Zugriff mit PHP auf eine MySQL-Datenbank?
[ ] Verarbeitung des zurückgelieferten Abfrageergebnisses mit PHP,
um Dein Array von Arrays zu erzeugen?
$data = array(
array('24.12', 5),
array('24.12', 5),
// ...
array('24.12', 5)
);
Noch zwei Fragen zur Umgebung:
Welche PHP-Version?
Welche MySQL-Version?
Freundliche Grüße
Vinzenz