Viewing file: expensesmonthly.php (7.19 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include('session.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Monthly Expenses</title> <script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> <link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" /> <style type="text/css"> table { border: 0px solid green; border-collapse: collapse; width:100%; }
table td { border: 0px solid green; }
table td.shrink { white-space:nowrap } table td.expand { width: 99% }
</style> <style style="text/css"> .hoverTable{ width:100%; border-collapse:collapse; } .hoverTable td{ padding:7px; border:#4e95f4 1px solid; } /* Define the default color for all the table rows */ .hoverTable tr{ background: #b8d1f3; } /* Define the hover highlight color for the table row */ .hoverTable tr:hover { background-color: #ffff99; } </style> <script language="JavaScript" type="text/javascript"> <!--
function Toggle(obj){ var val=obj.value; if (!obj.m){ obj.m=''; } if (!obj.m.match(val)){ obj.m+=','+val+','; } var hide=obj.m.split(','); for (var zxc0=0;zxc0<hide.length;zxc0++){ if (document.getElementById(hide[zxc0])){ document.getElementById(hide[zxc0]).style.display='none'; } } var show=val.split(','); for (var zxc1=0;zxc1<show.length;zxc1++){ if (document.getElementById(show[zxc1])){ document.getElementById(show[zxc1]).style.display=''; } } }
//--> </script> </head> <center> <body>-
<table border="0" bgcolor="#FFFFFF"> <tr> <td colspan="2"><?php include('header.php'); ?></td> </tr> <tr> <td colspan="2"> <table border="0"> <tr> <td colspan="3" bgcolor="#CCCCCC"><?php include('menubar.php'); ?></td> </tr> <tr> <td bgcolor="#6699CC">Welcome <?php echo $user ?></td> <td bgcolor="#6699CC"><a href="logout.php">Logout</a></td> <td bgcolor="#6699CC"><?php echo "Today is " . date("d/m/y") . "<br>";?></td> </tr> </table> </td> </tr> <tr> <td > <form action="" method="get" name="form"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td>SELECT MONTH <label for="select"></label> <select name='q' align=\"left\" id='q'> <option><?php echo Date('d') ?></option> <option value='01'>01</option> <option value='02'>02</option> <option value='03'>03</option> <option value='04'>04</option> <option value='05'>05</option> <option value='06'>06</option> <option value='07'>07</option> <option value='08'>08</option> <option value='09'>09</option> <option value='10'>10</option> <option value='11'>11</option> <option value='12'>12</option> </select> </select> SELECT YEAR <label for="select"></label> <select name='r' align=\"left\" id='r'> <option><?php echo Date('Y') ?></option> <option>2014</option> <option>2015</option> <option>2016</option> <option>2017</option> <option>2018</option> <option>2019</option> <option>2020</option> </select> BRANCH NAME : <?php // Create connection $con=mysqli_connect("localhost","anshdiam_user","rb!ans838","anshdiam_sarkmicr_data");
// Check connection if (mysqli_connect_errno())
// Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else { echo "We are connected."; }
$result = mysqli_query($con,"SELECT ID, username FROM login ");
?> <select name="p" id="p" > <? while($row = mysqli_fetch_array($result)) { echo "<option value='" . $row['username'] . "'>" . $row['username'] . "</option>"; } ?> </select> <input type="submit" name="Submit" value="Search" /> </form> </td> <td> </td> </tr> </table> </form> </td> </tr> <tr> <td> </td> </tr> <tr> <td colspan="2"> <td width="0"></td> <?php
// Get the search variable from URL
$var = @$_GET['q'] ; $trimmed = trim($var); $varr = @$_GET['r'] ; $trimmedr = trim($varr); $varp = @$_GET['p'] ; $trimmedp = trim($varp); //trim whitespace from the stored variable
// rows to return $limit=10;
// check for an empty string and display a message. if ($trimmed == "") { exit; }
// check for a search parameter if (!isset($var)) { echo "<p>We dont seem to have a search parameter!</p>"; exit; }
mysql_connect("localhost","anshdiam_user","rb!ans838"); //(host, username, password)
//specify database ** EDIT REQUIRED HERE ** mysql_select_db("anshdiam_sarkmicr_data") or die("Unable to select database"); //select which database we're using
$field = 'jmonth'; $fieldr = 'jyear'; $fieldt = 'branch';
// Build SQL Query $query = "select * from missadd where $field like \"$trimmed\" AND $fieldr like \"$trimmedr\" AND $fieldt like \"$trimmedp\" order by $field"; // EDIT HERE and specify your table and field names for the SQL query
$numresults=mysql_query($query); $numrows=mysql_num_rows($numresults);
// If we have no results, offer a google search as an alternative
if ($numrows == 0) {
}
// next determine if s has been passed to script, if not use 0 if (empty($s)) { $s=0; }
// get results $query .= " limit $s,$limit"; $result = mysql_query($query) or die("Couldn't execute query");
// begin to show results set echo "<table border=\"1\" bgcolor='#FFFFFF' style='table-layout:fixed' class='hoverTable'>\n";
echo " <tr bgcolor='#00CCCC'>\n"; echo " <td>BRANCH</td>\n"; echo " <td>DATE</td>\n"; echo " <td >AMOUNT</td>\n"; echo " <td >DISCRIPTION</td>\n";
echo " </tr>\n"; echo "</table>\n"; echo "\n"; // begin to show results set $count = 1 + $s ;
// now you can display the results returned while ($row= mysql_fetch_array($result)) { $total=$row[amount]+$total; echo "<table border=\"1\" style='table-layout:fixed' class='hoverTable'>\n";
echo " <tr bgcolor='#99CCCC'>\n"; echo " <td >$row[branch]</td>\n"; echo " <td>$row[jdate]/$row[jmonth]/$row[jyear]</td>\n"; echo " <td width='100px'>$row[amount]</td>\n"; echo " <td width='100px'>$row[discription]</td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "\n";
$count++ ; }
$currPage = (($s/$limit) + 1);
//break before paging echo "";
// next we need to do the links to other results if ($s>=1) { // bypass PREV link if s is 0 $prevs=($s-$limit); print "<a href=\"$PHP_SELF?s=$prevs&q=$var\"><< Prev 10</a> "; }
// calculate number of pages needing links $pages=intval($numrows/$limit);
// $pages now contains int of pages needed unless there is a remainder from division echo "Total Amount: $total";
?>
</tr></table> </body></center> </html>
|