Array problems

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



      I find myself stuck in coming up with a way to cycle through this
array of db results for porting to a graphing script that I did not
write.  My latest attempt to get around this problem is below.  Outside
of the $graph->SetDataValues(array( ));, echoing $array[$i] produces the
desired results for three sets of two bar graphs with the corresponding
title.  However, inside the $graph function, I get only the last
expected set of bar graphs and title.  I originally iterated through
each anticipated result from mysql_fetch_array($result) and plugged each
of these values into an array calling the columns individually. I got
the desired graph, but, of course this is bad programming and not useful
for queries producing a greater number of rows (I simply needed to know
it worked).  Any help would be appreciated.

 

______________________

 

$query = "1st SELECT code";

   // Run the query created above on the database through the connection
      if (!($result1 = @ mysql_query ($query, $connection)))
         showerror();
      
            
      
      $query = "2nd SELECT code";

   // Run the query created above on the database through the connection
      if (!($result2 = @ mysql_query ($query, $connection)))
         showerror();
while ($row_1st= @ mysql_fetch_array($result1)) && ($row_2nd = @
mysql_fetch_array($result2)))
      {     
       
      $field1[$i]=$row_1st["column1"];
      $field2[$i]=$row_1st["column2"];
      $field3[$i]=$row_2nd["column1"];
      $array[$i]=array($field1[$i], $field2[$i], $field3[$i]); 



      
      $graph->SetDataValues(array(
            $array[$i]
                   
      ));
}
    $graph->DrawGraph(); 
?>
 

 

Michael Conway

mconway3@cox.net

(703) 968-8875

 


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux