me1000 Posted March 7, 2008 Share Posted March 7, 2008 array('CourseName'=>'','number'=>'','Complete'=>'','expired'=>"",'inProgress'=>"") // make the first row blank, foreach ($arrCourses as $strKey => $strRow) { // Total Enrolled $strQuery = ""; $intEnrolled = $Database->db->MyQuery($strQuery); $counter['1'] = $counter['1'] + $intEnrolled; // Completed $strQuery = ""; $intCompleted = $Database->db->MyQuery($strQuery); $counter['2'] = $counter['2'] + $intCompleted; // Expired without Completing $strQuery = ""; $intExpired = $Database->db->MyQuery($strQuery); $counter['3'] = $counter['3'] + $intExpired; // In Progress $strQuery = ""; $intProgress = $Database->db->MyQuery($strQuery); $counter['4'] = $counter['4'] + $intProgress; ,array('CourseName'=>$strRow['series'] ." ". $strRow['number'] ." (". $strRow['odid'].")",'number'=>$intEnrolled,'Complete'=>$intCompleted,'expired'=>$intExpired,'inProgress'=>$intProgress) } ,array('CourseName'=>"TOTAL",'number'=>$counter['1'],'Complete'=>$counter['2'],'expired'=>$counter['3'],'inProgress'=>$counter['4']) ); So basically I need the foreach loop to fill out the array, but from the php error im getting back Im going to guess that PHP doesnt let you do that. So is there a way I can? Thanks, EDIT: By the way, I removed most of the queries prior to post because it is pointless to post them, but there error im getting is unexpected T_FOREACH, expecting ')' so I know the problem is the loop! Quote Link to comment Share on other sites More sharing options...
shocker-z Posted March 7, 2008 Share Posted March 7, 2008 Your missing a semi colon array('CourseName'=>'','number'=>'','Complete'=>'','expired'=>"",'inProgress'=>"") // make the first row blank, needs to be array('CourseName'=>'','number'=>'','Complete'=>'','expired'=>"",'inProgress'=>""); // make the first row blank, Also you haven't set the array to a variable therefore this is doing nothing at all! Regards Liam Quote Link to comment Share on other sites More sharing options...
me1000 Posted March 7, 2008 Author Share Posted March 7, 2008 This was just a snippet of code, the array is fine because I was using random data in it before. this should be at the top of all of it, I just forgot to select it when I copied it, $data4 = array( /code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.