Hi,
Suppose one $centre_name has two nodes and the values are fetched from table1 and pushed into the array.
When the function is called when i print the values using centre name and node name 4 times the values are printed.
Please tell me how to push the data into the array and when called only the single value has to be printed.
for($i=0;$i<=count($node);$i++){
foreach($node as $node){
print $cent['JNU']['master'][$i];
}
the output is got is
0(1)(1)0(1)(1)PHP Notice: Undefined offset: 1 in /var/www/html/
instead of 3 values like 0(1)(1).
Array
(
=> 0[JNU] => Array
(
[master.jnu.ac.in] => Array
(
=> 0(1)(1)
)
[cluster.jnu.ac.in] => Array
(
=> 0(1)(1)
)
)
)
function centreagg($centre_name){
$centreaggregate = array(0);
$sql = "select distinct(node) from master_table where centre_name='".$centre_name."')";
$node = array();
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
array_push($node,$row[0]);
}
$q=0;
foreach($node as $_)
{
$value = array(0);
$sql_net_perf = "select * from table1 where node = '".$_."' group by node";
//$sql_net_perf = "select count(*),cm.no_of_nodes,cm.total_nodes from nodes_details_cur nd, cluster_master cm where nd.head_node = cm.head_node and status = 0 and nd.head_node = '".$_."' group by nd.head_node";
$result = mysql_query($sql_net_perf);
while($row = mysql_fetch_array($result))
{
$value[0]=$row[1].'('.$row[0].')'.'('.$row[0].')';
}
$centrevalues[$node[$q++]]=$value;
}
$centreaggregate[$centre_name]=$centrevalues;
return $centreaggregate;
}
$cent=($centre_name);
$node=array('master','cluster');
for($i=0;$i<=count($node);$i++){
foreach($node as $nod){
print $cent[$centre_name][$nod][$i];
//print $cent[$centre_name][$head][$i];
}
}