Roberticus Posted February 7, 2013 Share Posted February 7, 2013 I had this hosted on ehost for awhile because I had another site there, but then realized I was paying for a bunch of functionality I wasn't using so I moved everything over to zymic. Everything worked fine on ehost, and all but a few of my pages are working fine on zymic. With this particular one I get the following error: Invalid argument supplied for foreach() in /www/zxq.net/a/n/n/annimanager/htdocs/manager/summary.php on line 54 Here's the code: <?php include 'scripts/php/dbcon.php'; if ( !isset($year) ) { $year = date(Y); } $qry_list_years = mysql_query("SELECT YEAR(Sstart) AS year FROM sessions GROUP BY YEAR(Sstart) DESC"); if (!$qry_list_years) { echo mysql_error(); exit(); } $qry_payments = mysql_query("SELECT SUM(Pmtamt) AS pamt, MONTH(Pmtdate) AS month FROM payments WHERE YEAR(Pmtdate) = '$year' GROUP BY month DESC"); if (!$qry_payments) { echo mysql_error(); exit(); } $qry_expenses = mysql_query("SELECT SUM(r_total) AS total, MONTH(r_date) AS month FROM receipts WHERE YEAR(r_date) = '$year' GROUP BY month DESC"); if (!$qry_expenses) { echo mysql_error(); exit(); } $qry_earnings = mysql_query(" SELECT MONTH(Sstart) AS month, SUM(IF('M' = Stype, TIME_TO_SEC(TIMEDIFF(Send,Sstart))/3600, 0)) AS mix_hrs, SUM(IF('R' = Stype, TIME_TO_SEC(TIMEDIFF(Send,Sstart))/3600, 0)) AS rec_hrs, SUM(TIME_TO_SEC(TIMEDIFF(Send,Sstart))/3600) AS total_hrs, SUM(IF('B' = Sbilltype,(5 * Sbillrate) + (GREATEST((TIME_TO_SEC(TIMEDIFF(Send,Sstart))/3600)-6,0) * Sbillrate * Sdiscount),Sbillrate * Sdiscount * TIME_TO_SEC(TIMEDIFF(Send,Sstart))/3600)) AS subtotal FROM sessions WHERE YEAR(sessions.Sstart) = '$year' GROUP BY month DESC "); while ( $row = mysql_fetch_assoc($qry_payments) ) { $summary[$row['month']-1][0] = $row['pamt']; $summary[12][0]+=$row['pamt']; } while ( $row = mysql_fetch_assoc($qry_expenses) ) { $summary[$row['month']-1][2] = $row['total']; $summary[12][2]+=$row['total']; } while ( $row = mysql_fetch_assoc($qry_earnings) ) { $summary[$row['month']-1][1] += $row['subtotal']; $summary[12][1] += $row['subtotal']; $summary[$row['month']-1][3]+=$row['mix_hrs']; $summary[12][3]+=$row['mix_hrs']; $summary[$row['month']-1][4]+=$row['rec_hrs']; $summary[12][4]+=$row['rec_hrs']; $summary[$row['month']-1][5]+=$row['total_hrs']; $summary[12][5]+=$row['total_hrs']; } foreach ($summary as $month => $value) { $summary[$month][0] = '$' . money_format('%i', $value[0]); $summary[$month][1] = '$' . money_format('%i', $value[1]); $summary[$month][2] = '$' . money_format('%i', $value[2]); $summary[$month][3] = round($value[3], 1); $summary[$month][4] = round($value[4], 1); $summary[$month][5] = round($value[5], 1); } ?> Am I using a deprecated function or something? PHP version on zymic is 5.2.12 Quote Link to comment https://forums.phpfreaks.com/topic/274137-help-with-a-simple-fix/ Share on other sites More sharing options...
Roberticus Posted February 7, 2013 Author Share Posted February 7, 2013 This has to be the most effective form of advertising known to man... Quote Link to comment https://forums.phpfreaks.com/topic/274137-help-with-a-simple-fix/#findComment-1410667 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.