thenorman138 Posted March 21, 2018 Share Posted March 21, 2018 I have two functions, one loading data and the other loading the data into an html table. I've done this for 3 other data sets without issue but this one is not loading into the table for some reason. The html table loads but it's empty. I have error printing on but there are no errors. Also the query returns the correct results when I manually run it so I know it's getting results, plus it's printing the result resource ID. So my result prints, and my html table shows up, but the results are not in the table so I'm assuming maybe I'm not passing it to the table properly? Any guidance here is greatly appreciated //Function to gather data private function loadActivity($cust) { $this->dbConnect(); //loading set data values from top of function file $fromC = $this->cy_from; $fromP = $this->py_from; $thruC = $this->cy_thru; $thruP = $this->py_thru; $endYr = $this->py_endYr; $query = " select count(*), 'PRIOR' as Range from actvty where cust = {$cust} AND date between '{$fromP}' and '{$thruP}' union all select count(*), 'CURRENT' as Range from actvty where cust = {$cust} AND date between '{$fromC}' and '{$thruC}' union ALL select count(*), 'FULL' as Range from actvty where cust = {$cust} AND date between '{$fromP}' and '{$endYr}'"; $result = odbc_exec($this->ocon,$query); print_r($result); //This prints "Resource ID #76" $this->activitySum = array(); if ($result) { while ($row = odbc_fetch_array($result)) { $this->activitySum[$row['Range']]; $this->isloaded = true; } }else{ echo"query failed" . odbc_error(); } } public function getCallActivityHTMLcust($cust, $header='Activity'){ $this->loadActivity($cust); $h2 = "<table class='customer-table'>"; $h2 .= "<thead><tr><th colspan='2' style='font-weight: bold'></th>" . htmlspecialchars($header) . "</tr></thead>"; $h2 .= "<tbody>"; $h2 .= "<tr><td>{$this->pyyy} YTD</td><td style='text-align: right;'>" . $this->activitySum['PRIOR'] . "</td></tr>"; $h2 .= "<tr><td>{$this->yyyy} YTD</td><td style='text-align: right;'>" . $this->activitySum['CURRENT'] . "</td></tr>"; $h2 .= "<tr><td>{$this->pyyy} Full Year</td><td style='text-align: right;'>" . $this->activitySum['FULL'] . "</td></tr>"; $h2 .= "</tbody></table>"; return $h2; } Quote Link to comment Share on other sites More sharing options...
Barand Posted March 21, 2018 Share Posted March 21, 2018 $this->activitySum[$row['Range']]; That line isn't doing much. Shouldn't it be putting the count into the array. 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.