Advertisement
Advertisement
| 05.25.2008 at 11:23AM PDT, ID: 23431475 |
|
[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: |
<?php
//let the server give you feedback upon errors/warnings
error_reporting(E_ALL);
$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['middle'] = " 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['middle']) )
$checkedFields['middle']="";
}
?>
<!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>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post" name="select" id="select">
<input type="checkbox" name="invoice_num" value="1" <?=$checkedFields['invoice_num']?> />Invoice
<input type="checkbox" name="firstname" value="1" <?=$checkedFields['firstname']?> />First Name
<input type="checkbox" name="lastname" value="1" <?=$checkedFields['lastname']?> />Last Name
<input type="checkbox" name="middle" value="1" <?=$checkedFields['middle']?> />Middle
<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';
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><a href='{$_SERVER[PHP_SELF]}?Orderby=invoice_num'>Invoice</a></th>";
}
if( !empty($checkedFields['firstname']) )
{
++$colspan;
print "<th><a href='{$_SERVER[PHP_SELF]}?Orderby=firstname'>1st Name</a></th>";
}
if( !empty($checkedFields['lastname']) )
{
++$colspan;
print "<th><a href='{$_SERVER[PHP_SELF]}?Orderby=lastname'>Last Name</a></th>";
}
if( !empty($checkedFields['middle']) )
{
++$colspan;
print "<th><a href='{$_SERVER[PHP_SELF]}?Orderby=middle'>Middle Initial</a></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}'><font size='2'>{$value}</font></td>";
}
print "</tr>";
$row_count++;
}
print "</table>";
?>
</body>
</html>
|