php - How to add multiple values onto the same array -
i want show information on page regarding multiple queries, each of them representing project status. that, made while loop, adds information array.
the problem that, show 1 of statuses available, first one. here code:
$exec = mysql_query($queryontime) or trigger_error(mysql_error()); $exec1 = mysql_query($querydelayed) or trigger_error(mysql_error()); $exec2 = mysql_query($querypending) or trigger_error(mysql_error()); $array_dados = array(); // chart data while($info = mysql_fetch_array($exec)||$info1 = mysql_fetch_array($exec1)||$info2 = mysql_fetch_array($exec2)){ $array_dados[] = $info; $array_dados[] = $info1; $array_dados[] = $info2; } return $array_dados;
so can see, have 3 queries, , try adding of them array, yet 1 of $info shows up. why that?
edit:
i removed or , separated fetch arrays, yet still shows "pending" one. here's how looks right now:
$exec = mysql_query($querypending) or trigger_error(mysql_error()); $exec1 = mysql_query($queryontime) or trigger_error(mysql_error()); $exec2 = mysql_query($querydelayed) or trigger_error(mysql_error()); $array_dados = array(); //all chart data while($info = mysql_fetch_array($exec)) $array_dados[] = $info; while($info1 = mysql_fetch_array($exec1)) $array_dados[] = $info1; while($info2 = mysql_fetch_array($exec2)) $array_dados[] = $info2; return $array_dados;
you also..
$exec = mysql_query($queryontime) or trigger_error(mysql_error()); $exec1 = mysql_query($querydelayed) or trigger_error(mysql_error()); $exec2 = mysql_query($querypending) or trigger_error(mysql_error()); $array_dados = array(); // chart data while($info = mysql_fetch_array($exec) && $info1 = mysql_fetch_array($exec1) && $info2 = mysql_fetch_array($exec2)){ $array_dados[] = $info; $array_dados[] = $info1; $array_dados[] = $info2; } return $array_dados;
hope help.
Comments
Post a Comment