Advertisement
| 05.29.2008 at 09:45AM PDT, ID: 23442070 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: |
<?php
$DB_SERVER=""; // specify IP or domain of your db server
$DB_USERNAME="";
$DB_PASSWORD="";
$DB_NAME=""; // specify name of your database
//set the default state for the checkboxes
$checkedFields = array();
$checkedFields['invoice_num'] = " checked='checked' ";
$checkedFields['firstname'] = " checked='checked' ";
$checkedFields['lastname'] = " checked='checked' ";
$checkedFields['transaction_date'] = " checked='checked' ";
if( isset($_REQUEST['fieldTracker']) )
{
//determine the "unchecked" ones
if( empty($_REQUEST['invoice_num']) )
$checkedFields['invoice_num']="";
if( empty($_REQUEST['firstname']) )
$checkedFields['firstname']="";
if( empty($_REQUEST['lastname']) )
$checkedFields['lastname']="";
if( empty($_REQUEST['transaction_date']) )
$checkedFields['transaction_date']="";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
<div align="center">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="select" id="select">
<input type="checkbox" name="invoice_num" value="1" <?php echo $checkedFields['invoice_num']?>>Invoice
<input type="checkbox" name="firstname" value="1" <?php echo $checkedFields['firstname']?>>First Name
<input type="checkbox" name="lastname" value="1" <?php echo $checkedFields['lastname']?>>Last Name
<input type="checkbox" name="transaction_date" value="1" <?php echo $checkedFields['transaction_date']?>>Date <br>
Sort By
<select name="Orderby" id="Orderby">
<option value="invoice_num"<?php if(isset($_REQUEST['Orderby']) && $_REQUEST['Orderby'] == 'invoice_num') : ?> selected="selected"<?php endif; ?>>Invoice Number</option>
<option value="firstname"<?php if(isset($_REQUEST['Orderby']) && $_REQUEST['Orderby'] == 'firstname') : ?> selected="selected"<?php endif; ?>>First Name</option>
<option value="lastname"<?php if(isset($_REQUEST['Orderby']) && $_REQUEST['Orderby'] == 'lastname') : ?> selected="selected"<?php endif; ?>>Last Name</option>
<option value="transaction_date"<?php if(isset($_REQUEST['Orderby']) && $_REQUEST['Orderby'] == 'transaction_date') : ?> selected="selected"<?php endif; ?>>Date</option>
</select>
<br>
From: <input name="date_start" value="<?php echo isset($_REQUEST['date_start']) ? $_REQUEST['date_start'] : ''; ?>">
To: <input name="date_end" value="<?php echo isset($_REQUEST['date_end']) ? $_REQUEST['date_end'] : ''; ?>"><br>
<input name="fieldTracker" type="submit" value="submit">
</form>
</div>
<?php
if ( !($link = mysql_connect($DB_SERVER, $DB_USERNAME, $DB_PASSWORD)) ) {
echo 'Could not connect to mysql: ' . mysql_error();
exit;
}
if (!mysql_select_db($DB_NAME, $link)) {
echo 'Could not select database: ' . mysql_error();
exit;
}
$sql = 'SELECT * FROM tbl_authnet_data';
$sql = $sql . " WHERE transaction_date < '" . date('Y-m-d H:i:s' , strtotime($_POST['date_end'])) . "' AND transaction_date > '" . date('Y-m-d H:i:s' , strtotime($_POST['date_start'])) . "'";
if (isset($_REQUEST['Orderby']))
{
$sql = $sql . " Order By ". $_REQUEST['Orderby'];
}
$result = mysql_query($sql, $link) or die("Query Error: " . mysql_error());
if (!$result) {
echo "DB Error, could not query the database\n";
echo 'MySQL Error: ' . mysql_error();
exit;
}
$colspan=0;
print "<table align='center' border='0' cellpadding='2' bgcolor='#CCCCCC'>";
print "<tr style='color: white;'>";
if( !empty($checkedFields['invoice_num']) )
{
++$colspan;
print "<th>Invoice</th>";
}
if( !empty($checkedFields['firstname']) )
{
++$colspan;
print "<th>1st Name</th>";
}
if( !empty($checkedFields['lastname']) )
{
++$colspan;
print "<th>Last Name</th>";
}
if( !empty($checkedFields['transaction_date']) )
{
++$colspan;
print "<th>Date</th>";
}
print "</tr>";
print "<tr><td colspan='{$colspan}'></td></tr>";
// Define colors for alternating rows
$color1 = "#fffaf0";
$color2 = "#ffffff";
$row_count = 0;
while ($row = mysql_fetch_assoc($result))
{
$row_color = ($row_count % 2) ? $color1 : $color2;
print "<tr>";
foreach ($row as $field => $value)
{
if( isset($checkedFields[$field]) && !empty($checkedFields[$field]) )
print "<td nowrap='nowrap' align='center' bgcolor='{$row_color}'>{$value}</td>";
}
print "</tr>";
$row_count++;
}
print "</table>";
?>
</body>
</html>
|
Advertisement