Page 1 of 1

Array problem

Posted: Sun Jun 02, 2013 8:06 am
by lekan_dny
using this query:

Code: Select all

		$queryC = "SELECT * FROM  tbl_courses WHERE course_id='$course_id'";
			$resC = mysql_fetch_assoc(dbQuery($queryC));	
			$allUnits = $resC[course_unit];
print_r(array($allUnits));
returns:
Array ( [0] => 3 ) Array ( [0] => 3 ) Array ( [0] => 2 ) Array ( [0] => 2 )

but am expecting it to return

Array ( [0] => 3 ) Array ( [1] => 3 ) Array ( [2] => 2 ) Array ( [3] => 2 )


anybody whit usefull help please....


I need it as soon as possible

Thanks in advance

Re: Array problem

Posted: Sun Jun 02, 2013 8:58 am
by social_experiment
If you are looking for a single array that contains all the values modify your code slightly

Code: Select all

while ($resC = mysql_fetch_assoc(dbQuery($queryC))) {
      $allUnits[] = $resC[course_unit];
}