function printFinancialIndexTable($cid) { $obj1 = new db_controller_unit(); if (!empty($obj1->isExistedFinancialIndexData($cid))) { $financial_index_data = $obj1->getComapnyFinancialIndex($cid); echo '<div id="demoDiv"><div id="demoGrid"><table id="demoTable"><colgroup><col id="demoTableCol1"></colgroup><thead><tr>'; for ($i = 0; $i < count($financial_index_data[0]); $i++) { echo '<th><span id="demoHdr' . ($i + 1) . '">' . $financial_index_data[0][$i] . '</span></th>'; } echo '</tr></thead><tbody>'; for ($i = 1; $i < count($financial_index_data); $i++) { echo '<tr>'; for ($j = 0; $j < count($financial_index_data[0]); $j++) { // title class if ($i === 1 or $i === 11 or $i === 16 or $i === 21 or $i === 24) { echo '<td class="finacial_title">' . $financial_index_data[$i][$j] . '</td>'; } else { if ($j === 0) { echo '<td class="g_title">' . $financial_index_data[$i][$j] . '</td>'; } else { if ((double) $financial_index_data[$i][$j] < 0 and $financial_index_data[$i][$j] != '-') { echo '<td><font color="red">' . $this->thousandsplit($financial_index_data[$i][$j]) . '</font></td>'; } else { echo '<td>' . $this->thousandsplit($financial_index_data[$i][$j]) . '</td>'; } } } } echo '</tr>'; } echo '</tbody></table></div></div>'; } else { echo '<br>no data'; } }
<?php /* 檢查 input string 是否為財務指標頁面有資料的公司 */ $str = $_GET['input']; include './db_controller_unit.php'; $obj1 = new db_controller_unit(); $cid = $obj1->isExistedFinancialIndexData($str); echo $cid;