Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.