|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| Question |
|
[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: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: |
<?php
//error handling
//ini_set('error_reporting',E_ALL);
//ini_set('display_errors',1);
include 'main_new.php';
include_once('../inludes/db.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" />
<link rel="stylesheet" type="text/css" media="screen" href="../builder/chassis/css/table.css" />
<script src="js/sorttable.js"></script>
<title>Search</title>
</head>
<body>
<form name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">
<input type="text" onfocus="this.value = (this.value=='Enter your search...')? '' : this.value;" value="Enter your search..." name="q" />
<input type="submit" name="Submit" value="Search" />
</form>
<?php
// Get the search variable from URL
$var = (!empty($_GET['q'])) ? mysql_real_escape_string(trim($_GET['q'])) : '';
// rows to return
$limit=25;
// check for an empty string and display a message.
if (empty($var))
{
echo "<p></p>";
exit;
}
// Build SQL Query
$query = "SELECT ID,name,description,vendor,IFNULL(price,'N/A')price,IFNULL(cost,'N/A')cost,IFNULL(category,'N/A')category,IFNULL(subcategory,'N/A')subcategory FROM prices WHERE name LIKE '%$var%' OR description LIKE '%$var%' OR vendor LIKE '%$var%' OR category LIKE '%$var%' OR subcategory LIKE '%$var%'";
//$query = "SELECT * FROM prices WHERE name LIKE '%$var%' OR description LIKE '%$var%' OR vendor LIKE '%$var%' OR category LIKE '%$var%' OR subcategory LIKE '%$var%'"; // EDIT HERE and specify your table and field names for the SQL query
$drop1="select id, IFNULL(category,'N/A')category from prices where name LIKE '%$var%' OR description LIKE '%$var%' OR vendor LIKE '%$var%' OR category LIKE '%$var%' OR subcategory LIKE '%$var%' group by category order by id asc";
$drop2="select id, IFNULL(subcategory,'N/A')subcategory from prices where name LIKE '%$var%' OR description LIKE '%$var%' OR vendor LIKE '%$var%' OR category LIKE '%$var%' OR subcategory LIKE '%$var%' group by subcategory order by id asc";
$numresults=mysql_query($query);
$numrows=mysql_num_rows($numresults);
// If we have no results, offer a google search as an alternative
if ($numrows == 0)
{
echo "<h4>Results</h4>";
echo "<p>Sorry, your search: "" . $var . "" returned zero results</p>";
}
// next determine if s has been passed to script, if not use 0
$s = (!empty($_GET['s'])) ? intval($_GET['s']) : 0;
// get results
$query .= " limit $s,$limit";
$result = mysql_query($query) or die("Couldn't execute query");
// display what the person searched for
echo "<p>Your search results for <strong> "" . $var . ""</strong> are as below..</p>";
// begin to show results set
//echo "<h4>Results</h4>";
$count = 1 + $s ;
$currPage = (($s/$limit) + 1);
echo "<select>";
//echo "<option>Filter by Category</option>";
$res=mysql_query($drop1);
echo "<option>Filter by Category</option>";
while(list($id,$category)=mysql_fetch_row($res))
{
echo "<option value=\"".$id."\">".$category."</option>";
}
echo "</select> OR ";
echo "<select>";
echo "<option>Filter by Subcategory</option>";
$res2=mysql_query($drop2);
while(list($id,$subcategory)=mysql_fetch_row($res2))
{
echo "<option value=\"".$id."\">".$subcategory."</option>";
}
echo "</select>";
//break before paging
echo "<br />";
// 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=\"$_SERVER[PHP_SELF]?s=$prevs&q=$var\"><<
Prev $limit</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
if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}
// check to see if last page
if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {
// not last page so give NEXT link
$news=$s+$limit;
echo " <a href=\"$_SERVER[PHP_SELF]?s=$news&q=$var\">Next $limit >></a>";
}
// now you can display the results returned
/*while ($row= mysql_fetch_array($result)) {
$title = $row["name"];
echo "$count.) $title<br>" ;
$count++ ;
}
*/
if(mysql_num_rows($result) )
{
echo "<table width=50% border=1 class=sortable>";
echo "<tr><th> </th><th>No</th><th>Name</th><th>Description</th><th>Vendor</th><th>List Price</th><th>Street Price</th><th>Category</th><th>Sub Category</th></tr>";
// now you can display the results returned
while ($row= mysql_fetch_array($result)) {
if($row['cost']=="N/A") {$dol1="";} else {
$dol1 = "$"; }
$dol = "$";
echo "<tr><td><input type='checkbox' name='price[]' value='{$row['ID']}' /></td><td>{$count}</td><td>{$row['name']}</td><td>{$row['description']}</td><td>{$row['vendor']}</td><td>$dol{$row['price']}</td><td>$dol1{$row['cost']}</td><td>{$row['category']}</td><td>{$row['subcategory']}</td></tr>";
$count++ ;
}
echo "</table>";
}
$currPage = (($s/$limit) + 1);
//break before paging
echo "<br />";
// 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=\"$_SERVER[PHP_SELF]?s=$prevs&q=$var\"><<
Prev $limit</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
if ($numrows%$limit) {
// has remainder so add one page
$pages++;
}
// check to see if last page
if (!((($s+$limit)/$limit)==$pages) && $pages!=1) {
// not last page so give NEXT link
$news=$s+$limit;
echo " <a href=\"$_SERVER[PHP_SELF]?s=$news&q=$var\">Next $limit >></a>";
}
$a = $s + ($limit) ;
if ($a > $numrows) { $a = $numrows ; }
$b = $s + 1 ;
echo "<p>Showing results $b to $a of $numrows</p>";
?></body>
</html>
|
Advertisement
| Hall of Fame |