Jump to content

php array help


fareedreg

Recommended Posts

I am getting trouble since today morning from the associative array. Actually I am using phpgraphlib.php to create line graph. Every thing is working fine.. I can easily create graph if i type value direct in the associative array like this.

 

include('phpgraphlib.php');

 

include('connect.php');

   

mysql_select_db($Db, $link);

 

$query = "select colone,coltwo from graphtemp";

 

$result = mysql_query($query,$link);

 

$nro=mysql_num_rows($result); 

 

$row=mysql_fetch_assoc($result);

 

while ($row = mysql_fetch_assoc($result))

        {

           

                $A[] = $row['colone'];

                $C[]= $row['coltwo'];

           

          }

 

$data=array("$A[0]"=>$C[0],$A[1]=>$C[1],$A[2]=>$C[2],$A[3]=>$C[3], $A[4]=>$C[4],$A[5]=>$C[5]);

 

$graph = new PHPGraphLib(750,400);

     

$graph->addData($data);

 

here i am mentioning only 6 number of rows.

 

 

 

but problem arise when i do not know the number of rows in the table. How can i accept the values from the mysql table when i do not know the exact number of row..

 

Please help

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/249184-php-array-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.