Advertisement
Advertisement
| 12.30.2007 at 06:11PM PST, ID: 23050208 |
|
[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: |
//Variables from form POST
$type=$_POST['type'];
$cost=$_POST['cost'];
$capacity=$_POST['capacity'];
$alcohol=$_POST['alcohol'];
$food=$_POST['food'];
$location=$_POST['location'];
$keywords=$_POST['keywords'];
//Connect to database
$con = mysql_connect("localhost","root");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("venuetest", $con);
// How many rows of results need to be on each page?
$rowsPerPage = 5;
// by default we show first page
$pageNum = 1;
// if $_GET['page'] defined, use it as page number
if(isset($_GET['page'])) {
$pageNum = $_GET['page'];
}
// Count the offset so each page will know how many rows to skip in order to get to the rows meant for each page
$offset = ($pageNum - 1) * $rowsPerPage;
//query database
$query = "select * from venues where (classification = '$type' AND
cost='$cost' AND
capacity='$capacity' AND
alcohol='$alcohol' AND
food='$food' AND
location='$location' AND
keywords LIKE '$keywords') LIMIT $offset, $rowsPerPage";
$result=mysql_query($query);
// We have to query the database again to count how many rows we have total
$query2 = "select * from venues where (classification = '$type' AND
cost='$cost' AND
capacity='$capacity' AND
alcohol='$alcohol' AND
food='$food' AND
location='$location' AND
keywords LIKE '$keywords')";
$result2 = mysql_query($query2) or die('Error, query2 failed');
$numrows = mysql_num_rows($result2);
//count total rows in database
$total = mysql_query("select * from venues") or die (mysql_error());
$dbtotal = mysql_num_rows($total);
//If no results display message
if ($numrows == 0)
{
echo ("Please return to the search page and broaden your search criteria");
}
//otherwise, display results in a table
else
{
echo "<table>
while($showresult = mysql_fetch_array( $result )) {
echo ("<tr><td>");
echo ($showresult["venue"]);
echo ("</td><td>");
echo ($showresult["email"]);
echo ("</td><td>");
echo ($showresult["images"]);
echo ("</td></tr>");
}
}
echo "</table>";
// how many pages we have when using paging?
$maxPage = ceil($numrows/$rowsPerPage);
// Print page number links
$self = $_SERVER['PHP_SELF'];
$nav = '';
for($page = 1; $page <= $maxPage; $page++) {
if ($page == $pageNum) {
$nav .= " $page "; // no need to create a link to current page
} else {
$nav .= " <a href=\"$self?page=$page&rowsPerPage=$rowsPerPage\" class='page'>$page</a> ";
}
}
// creating previous and next link
// plus the link to go straight to
// the first and last page
if ($pageNum > 1) {
$page = $pageNum - 1;
$prev = " <a href=\"$self?page=$page&rowsPerPage=$rowsPerPage\" class='page'><</a> ";
$first = " <a href=\"$self?page=1&rowsPerPage=$rowsPerPage\" class='page'><<</a> ";
} else {
$prev = ' '; // we're on page one, don't print previous link
$first = ' '; // nor the first page link
}
if ($pageNum < $maxPage) {
$page = $pageNum + 1;
$next = " <a href=\"$self?page=$page&rowsPerPage=$rowsPerPage\" class='page'>></a> ";
$last = " <a href=\"$self?page=$maxPage&rowsPerPage=$rowsPerPage\" class='page'>>></a> ";
} else {
$next = ' '; // we're on the last page, don't print next link
$last = ' '; // nor the last page link
}
// print the navigation link
echo $first . $prev . $nav . $next . $last;
// and close the database connection
mysql_close();
|