* Sunda Cyber Army 2k17 *
Indonesia Defacer ~
<?php
$mysql = new mysqli(
$host = "webdev.iyaclasses.com",
$userid = "dent_guest",
$userpw = "Acad276_Ttrojan_Dev2Ex@m",
$db = "dent_exam"
);
if($mysql->connect_errno) {
echo "db connection error : " . $mysql->connect_error;
exit();
}else{
echo "good SQL";
}
echo "<h2>Search Results</h2>";
echo "Your manufacturer was: ";
echo " " . $_REQUEST["manufacturer"];
echo "<br>";
echo "Your device was: ";
echo " " . $_REQUEST["device_name"];
echo "<br>";
$sql = "SELECT * FROM manufacturers WHERE 1=1 AND ";
if($_REQUEST['manufacturer'] !=''){
$sql .= "manufacturer LIKE '%" . $_REQUEST['manufacturer'] . "%'" ;
}
$results = $mysql->query($sql);
if(!$results){
echo "SQL ERRORhi";
echo $sql;
echo $mysql->error;
exit();
}else{
echo "Good Sql <3";
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Acad276 Practical Exam: Results</title>
<style>
.container {
width: 600px;
margin: auto;
}
h1 {
margin: auto;
text-align: center;
background-color: #900;
color: #FC0;
height: 60px;
line-height: 60px;
}
.num-results {
margin: 20px 10px;
}
table {
margin: auto;
margin-bottom: 20px;
width: 80%;
border-collapse: collapse;
}
th, td {
border: 1px solid #900;
border-collapse: collapse;
padding: 10px;
text-align: center;
}
img {
width: 100px;
}
.nav-link{
margin: 10px 0px;
font-size: 14px;
}
</style>
</head>
<body>
<div class="container">
<h1>Mobile Device Database: Search Results</h1>
<div class="nav-link">
<a href="search.php"><< Back to Search Page</a>
</div>
<div class="num-results">
Your search returned
<strong> <?php
echo $results->num_rows;
?></strong>
results.
</div>
<table>
<tr>
<th>Name</th>
<th>Price</th>
<th>Manufacturer</th>
<th>System</th>
<th>Type</th>
</tr>
<!--
****** SAMPLE OUTPUT ROW ******
-->
<tr>
<td><a href="details.php?id=12"><?php echo $_REQUEST['device_name']?></a></td>
<td></td>
<td><?php
while($currentrow = $results->fetch_assoc()) {
echo $currentrow['manufacturer'] . "<br>";}
//use the user inputted data and look at the table and output those results
//connect to edit page
//connect to view page
// echo "<div class='device_name'><strong>" .
// "<a href='details.php?id=" .
// $currentrow["device_id"] .
// "'>";
// . "</td>" . "<td>" . echo $currentrow['price'] . "<td>" / ?>
<td>Laptop</td>
</tr>
</table>
</div>
</body>
</html>
<?php
while($currentrow = $results->fetch_assoc()) {
echo "<div class='device_name'><strong>" .
"<a href='details.php?id=" .
$currentrow["device_id"] .
"'>";
}
?> <!--// this is what would send the data to the details page with the device id,
for each option I would load the data from dev
in the results page, it takes the data from the search page that the user inputted which was saved into the sql query
this is then outputted to this results page and the results should display in this format below:
<?php
//
//// $sql = "SELECT * FROM devices WHERE 1=1";
//// $sql .= " AND device_name LIKE '%" .
//// $_REQUEST['device_name'] . "%'";
//// if($_REQUEST['device_name'] != "ALL") {
//// $sql .= " AND type ='" . $_REQUEST["type"] . "'";
//// }
//// if($_REQUEST['manufacturer'] != "ALL") {
//// $sql .= " AND manufacturer = '" . $_REQUEST["manufacturer"] . "'";
//// }
//// if($_REQUEST['systems'] != "ALL") {
//// $sql .= " AND systems= '" . $_REQUEST["systems"] . "'";
//// }
//// if($_REQUEST['types'] != "ALL") {
//// $sql .= " AND types= '" . $_REQUEST["types"] . "'";
//// }
//// // $sql .= " ORDER BY ". $_REQUEST['orderby'];
////
//// $results = $mysql->query($sql);
////
//// if(!$results) {
//// echo "<hr>Your SQL:<br> " . $sql . "<br><br>";
//// echo "SQL Error: " . $mysql->error . "<hr>";
//// exit();
//// }
//
?>