function get_tax_wk($this_lastmon) { //echo $this_lastmon; $curr_tx_yr = tx_yr_st($this_lastmon); //echo $curr_tx_yr; $wc_curr_tx_yr_st = tx_yr_st1($curr_tx_yr); //echo $wc_curr_tx_yr_st; $mkt_curr_tx_yr_st = d_unixh($wc_curr_tx_yr_st, 1); $mkt_wc = d_unixh($this_lastmon, 1); $diff = $mkt_wc - $mkt_curr_tx_yr_st; $tax_wk = $diff / 60 / 60 / 24 / 7 + 1; $tax_wk = round($tax_wk); return $tax_wk; }
function srch() { $q = $_POST['txt_q']; global $link; // FIND NUMBER OF OCCURRENCES OF SEARCH TEXT IN EACH DIARY ENTRY TO GENERATE DATA FOR DIARY_S TABLE. $r = $link->query("select * from diary_main order by d desc"); while ($rw = $r->fetch()) { $entry_info = trim($rw['info']); // $entry_info = str_replace($q, (' ' . $q), $entry_info); $entry_id = $rw['id']; $nm_occ = substr_count($entry_info, $q); if ($nm_occ > 0) { // echo $entry_id . ' > ' . $nm_occ . '<br />'; //$r_i = mysql_query("INSERT INTO diary_s VALUES (NULL, $entry_id, $nm_occ)"); } } // End while. $r = $link->query("select * from diary_main where info like '%{$q}%' order by d desc"); //$nm_s = $r->rowCount(); if ($r->rowCount() > 0) { //writeheader("Search Results: ".$nm_s.' Results found:', 0, 0, 0, 0, 0, '', 0, 1, 'php', 'diary app', '', 0, $nm_s.' Results found:'); echo '<html> <body><table cellpadding="2" cellspacing="0" border="1" width="100%"> <tr valign="top"> <td colspan="3"><form name="frm_s" method="post" action="tools2.php?act=s"><table cellpadding="4" cellspacing="0" border="0"> <tr valign="top"> <td><input type="text" name="txt_q" value="' . $q . '" /></td> <td><input type="submit" value="Search" /></td> <td><input type="button" value="Back" onclick="window.location=\'index.php?dt=' . @$dt . '\'" /></td> </tr> </table></form></td> </tr>'; while ($rw = $r->fetch(PDO::FETCH_ASSOC)) { $this_dt = $rw['d']; if (isset($q)) { $info = @eregi_replace($q, '<b>' . $q . '</b>', $rw['info']); } else { $info = $rw['info']; } // end if echo '<tr valign="top"> <td width="5"><span class="smallgreen">' . $rw['id'] . ' </span></td>'; if (date('Y-m-d') < @$dt_d) { echo '<td width="5" nowrap="nowrap"><a href="index.php?dt=' . d_unixh($this_dt) . '">' . formatmydate($this_dt) . '</a> </td>'; } else { echo '<td width="5" nowrap="nowrap"><a href="index.php?dt=' . d_unixh($this_dt) . '">' . formatmydate($this_dt) . '</a> </td>'; } // end if echo ' <td>' . nl2br(stripslashes($info)) . ' </td> </tr>'; } // end while echo ' </table>'; } else { echo 'No Results found:'; } // end if }