function updowntotal($center){
$centrevalues = array();
$sql = "select distinct(node) from `master_table`";
$nodes = array();
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
array_push($nodes,$row[0]);
}
$q=0;
foreach($nodes as $_)
{
$value = array();
$sql_net_perf = "select field1,field2,field3 from `table_name` where node = '".$_."' ";
$result = mysql_query($sql_net_perf);
if($row = mysql_fetch_array($result))
{
$value[0]=$row[0].'('.$row[1].')'.'('.$row[2].')';
}
$centrevalues[$nodes[$q++]]=$value;
}
return $centrevalues;
}
When I call the function
$centreCom= updowntotal($center);
and print based on $nodes array which is called separately
$count_centre = count($centreCom);
$count_nodes = count($nodes);
$s = $b = -1;
while (++$s < $count_centre) {
foreach ($nodes as $nod) {
while (++$b < $count_nodes) {
print $centreCom[$nod][$b];
}
}
}
For all the $nod $centreCom[0] is printed everywhere.
How to avoid it.
Based on the $nod, the value of $centreCom should be printed
Please help me