Muchas Gracias Tombar:
Exactamente como lo describes, el JPGRAPH lee la misma variable de REF_PRESUPUESTARIA que proviene del
mysql_fecth_array inicial y con este valor, hace otro
mysql_fecth_array en otra tabla extrayendo los valores a graficar.
Lo que deseo es que cuando hagas click en el litado de proyecto generado por el código inicial, tanto la nueva pagina en PHP como el script de JPGRAPH, puedan obtener el valor de
referencia y cada uno proceda a hacer lo suyo.
¿Como puedo sanitizar el $_GET a que haces referencia?
Te incluyo el código del
JPGRAHP Código PHP:
<?php
include ("inc/jpgraph.php");
include ("inc/jpgraph_line.php");
include ("listar_proyectos");
include ("config.php");
include ("opendb.php");
$ref = $_GET['referencia'];
$query = "SELECT * FROM $ref";
$result = mysql_query($query);
while($row = mysql_fetch_array($result))
{
//VARIABLES PLAN FISICO
$PLF_AA = $row['PLF_AA'];
$PLF_ENE = $row['PLF_ENE'];
$PLF_FEB = $row['PLF_FEB'];
$PLF_MAR = $row['PLF_MAR'];
$PLF_ABR = $row['PLF_ABR'];
$PLF_MAY = $row['PLF_MAY'];
$PLF_JUN = $row['PLF_JUN'];
$PLF_JUL = $row['PLF_JUL'];
$PLF_AGO = $row['PLF_AGO'];
$PLF_SEP = $row['PLF_SEP'];
$PLF_OCT = $row['PLF_OCT'];
$PLF_NOV = $row['PLF_NOV'];
$PLF_DIC = $row['PLF_DIC'];
$PLF_AF = $row['PLF_AF'];
}
$ydata = array($PLF_ENE, $PLF_FEB, $PLF_MAR, $PLF_ABR, $PLF_MAY, $PLF_JUN, $PLF_JUL, $PLF_AGO, $PLF_SEP, $PLF_OCT, $PLF_NOV, $PLF_DIC);
$graph = new Graph(550, 250, "auto");
$graph->SetScale( "textlin");
$graph->img->SetMargin(40, 20, 20, 40);
$graph->title->Set("EVOLUCION FINANCIERA");
$graph->xaxis->title->Set("Meses" );
$graph->yaxis->title->Set("MMBs." );
$lineplot =new LinePlot($ydata);
$lineplot ->SetColor("red");
$graph->Add( $lineplot);
$graph->Stroke();
?>
Como puedes ver, para este script, yo estoy tomando el mismo valor $ref = $_GET['referencia']; hecho en la otra pagina, propuesto por Rivahuevino. Recuerda que en cada iteracion se debe almacenar la variable referencia de alguna manera, porque se sobreescribe.
Muchas Gracias
DPERNIA