par
thehawk » 03 janv. 2007, 22:11
Merci a tous il arrive a l'affichage que tout est bon mais lorsque j'execute la suite ca ne marche pas
voici mon code entier j'utilise une bibliotheque Jpgraph comme sur le livre PHP5 avancé 3eme édition
<?php
mysql_connect("localhost","root","");
mysql_select_db("commercia");
$rt =array();
$config_nb_1 = mysql_query("SELECT metal FROM commerce_total");
while($ressource = mysql_fetch_assoc($config_nb_1))
{
//il faut boucler sur le résultat pour remplir un tableau
$rt[] = $ressource["metal"];
}
//transformation du tableau en chaine
$rt = implode(",",$rt);
//print_r($rt);
$datay1 = array ($rt);
$datay2 = array (1,1,2);
$datay3 = array (1,2,2);
// Setup the graph
include ("jpgraph/src/jpgraph.php");
include ("jpgraph/src/jpgraph_line.php");
$graph = new Graph(500,500);
$graph->SetMarginColor('white');
$graph->SetScale("textlin");
$graph->SetFrame(false);
$graph->SetMargin(30,50,30,30);
$graph->tabtitle->Set('Cette année' );
$graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,20);
$graph->yaxis->HideZeroLabel();
$graph->ygrid->SetFill(true,'#[email protected]','#[email protected]');
$graph->xgrid->Show();
$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());
// Create the first line
$p1 = new LinePlot($rt);
$p1->SetColor("navy");
$p1->SetLegend('Metal');
$graph->Add($p1);
// Create the second line
$p2 = new LinePlot($datay2);
$p2->SetColor("red");
$p2->SetLegend('Cristal');
$graph->Add($p2);
// Create the third line
$p3 = new LinePlot($datay3);
$p3->SetColor("orange");
$p3->SetLegend('Deuterium');
$graph->Add($p3);
$graph->legend->SetShadow('[email protected]',5);
$graph->legend->SetPos(0.1,0.1,'right','top');
// Output line
?>
merci si vous pouvez m'aider merci
Merci a tous il arrive a l'affichage que tout est bon mais lorsque j'execute la suite ca ne marche pas
voici mon code entier j'utilise une bibliotheque Jpgraph comme sur le livre PHP5 avancé 3eme édition
[php]<?php
mysql_connect("localhost","root","");
mysql_select_db("commercia");
$rt =array();
$config_nb_1 = mysql_query("SELECT metal FROM commerce_total");
while($ressource = mysql_fetch_assoc($config_nb_1))
{
//il faut boucler sur le résultat pour remplir un tableau
$rt[] = $ressource["metal"];
}
//transformation du tableau en chaine
$rt = implode(",",$rt);
//print_r($rt);
$datay1 = array ($rt);
$datay2 = array (1,1,2);
$datay3 = array (1,2,2);
// Setup the graph
include ("jpgraph/src/jpgraph.php");
include ("jpgraph/src/jpgraph_line.php");
$graph = new Graph(500,500);
$graph->SetMarginColor('white');
$graph->SetScale("textlin");
$graph->SetFrame(false);
$graph->SetMargin(30,50,30,30);
$graph->tabtitle->Set('Cette année' );
$graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,20);
$graph->yaxis->HideZeroLabel();
$graph->ygrid->SetFill(true,'#
[email protected]','#
[email protected]');
$graph->xgrid->Show();
$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());
// Create the first line
$p1 = new LinePlot($rt);
$p1->SetColor("navy");
$p1->SetLegend('Metal');
$graph->Add($p1);
// Create the second line
$p2 = new LinePlot($datay2);
$p2->SetColor("red");
$p2->SetLegend('Cristal');
$graph->Add($p2);
// Create the third line
$p3 = new LinePlot($datay3);
$p3->SetColor("orange");
$p3->SetLegend('Deuterium');
$graph->Add($p3);
$graph->legend->SetShadow('
[email protected]',5);
$graph->legend->SetPos(0.1,0.1,'right','top');
// Output line
?>
[/php]
merci si vous pouvez m'aider merci