Ver Mensaje Individual
  #5 (permalink)  
Antiguo 29/07/2005, 16:06
cpwebs
 
Fecha de Ingreso: abril-2002
Ubicación: Buacaramanga - Colombia
Mensajes: 46
Antigüedad: 22 años
Puntos: 0
Este funciona perfecto
Código PHP:
<?php
include ("C://apachefriends//xampp//htdocs//estadisticas//jpgraph//jpgraph.php");
include (
"C://apachefriends//xampp//htdocs//estadisticas//jpgraph//jpgraph_bar.php");
$db mysql_connect("localhost""root","") or die(mysql_error());
mysql_select_db("test",$db) or die(mysql_error());
$sql mysql_query("SELECT * FROM students") or die(mysql_error());
while(
$row mysql_fetch_array($sql))
{
$data[] = $row[1];
//$leg[] = $row[0];
}
$graph = new Graph(250,150,"auto");
$graph->SetScale("textint");
$graph->img->SetMargin(50,30,50,50);
$graph->AdjBackgroundImage(0.4,0.7,-1); //setting BG type
//$graph->SetBackgroundImage("venados.jpg",BGIMG_FILLFRAME); //adding image
$graph->SetShadow();
$graph->title->Set("Test1.php MySQL & JpGraph");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->SetTickLabels($leg);
$bplot = new BarPlot($data);
$bplot->SetFillColor("lightgreen"); // Fill color
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL,FS_BOLD);
$bplot->value->SetAngle(0);
//$bplot->value->SetColor("black","navy");
$bplot->SetFillGradient("blue","yellow",GRAD_MIDVER);
$graph->Add($bplot);
$graph->Stroke(); ?>
Este es el que genera el error
Código PHP:
<?php
include ("C://apachefriends//xampp//htdocs//estadisticas//jpgraph//jpgraph.php");
include (
"C://apachefriends//xampp//htdocs//estadisticas//jpgraph//jpgraph_pie.php");
include (
"C://apachefriends//xampp//htdocs//estadisticas//jpgraph//jpgraph_pie3d.php");
$db odbc_connect("test","","","");
$sqlodbc_exec($db,"select * from students");
while(
$row odbc_fetch_array($sql))
{
//$data[] = $row[1];
$data[] = $row[1];
}
odbc_close_all();
$graph = new PieGraph(300,200,"auto");
$graph->SetShadow();
$graph->title->Set("Test3.php MySQL & JpGraph");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$p1 = new PiePlot3D($data);
$p1->SetSize(.2);
$p1->SetCenter(0.40);
$p1->SetAngle(45);
$p1->SetLabelType(PIE_VALUE_ABS);
$p1->value->SetFont(FF_FONT1,FS_BOLD);
$p1->value->SetColor("red");
$p1->value->SetFormat('%d Tot');
$p1->value->Show();
$p1->ExplodeAll(5);
$p1->SetLegends($leg);
$graph->Add($p1);
$graph->Stroke();
?>
El problema al parecer esta en esta linea
Código PHP:
$data[] = $row[1]; 
que con mysql_fetch_array trabaja bien
Pero que con odbc_fetch_array me genera error
__________________
Tino
Linuxcol Soluciones Linux, Manuales, Noticias, foros, Seguridad
Linuxcol.com