NYCPHP Meetup

NYPHP.org

[nycphp-talk] data vector

Rafi Sheikh Rafi.Sheikh at Ingenix.com
Tue May 4 14:36:14 EDT 2004


Hi list.  Admittedly a very silly and basic question:

I need to pass data vector to a variable that could be later used to plot a
graph.  I am able to -finally!- get the data in an array format...and it
looks like this:

Array ( [0] => 59 [1] => 72 [2] => 45 ) 
Array ( [0] => 118 [1] => 77 [2] => 107)

But apparently I am not passing this data correctly.  My code is as follows:
[code]
<?php
....
while ($row=mysql_fetch_assoc($result)) { 
  $time['time'] =( $row['time']);
  $prio['priority'] = ($row['Priority']); 
  $valu['total'] =( $row['total']); 
//creating arrays
if(!is_array($plot[$prio['priority']]))
	{
        $plot[$prio['priority']] = array();
    	}	
	array_push($plot[$prio['priority']], $valu['total']);
}
// Assigning values
$g0=$plot[''];
$g1=$plot['1 - Started within one hour'];
$g2=$plot['2 - Started within four hours'];
$g3=$plot['3 - Started within 24 hours'];
$g4=$plot['4 - As soon as possible'];
// Printing those values
{
 print_r($g0);
echo "<br>";
 print_r($g1);
echo "<br>";
 print_r($g2);
echo "<br>";
 print_r($g3);
echo "<br>";
 print_r($g4);
}
?>
[/code]

Q1. Should I not use associative array?
Q2. How can I pass the data points in the var $g0-$g4 so the data vector is
passed?

I am signed up for some formal class in PHP in June-04, but I have to figure
this out before that, and plz. trust me when I say that this basic level of
headache is really embarassing, and yes, I have been reading and reading and
...

RS


This e-mail, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended
recipient or his or her authorized agent, the reader is hereby notified that
any dissemination, distribution or copying of this e-mail is prohibited. If
you have received this e-mail in error, please notify the sender by replying
to this message and delete this e-mail immediately.



More information about the talk mailing list