Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

(Help) PHP fail "Search" Code

xnayeon

Recruit
Basic Member
Messages
6
Reaction score
0
Points
16
Mga sir 2nd post ko na to hahah thanks po sa pagtulong saken dun sa edit code ko ..ngayon may pangalawang problema na ako.. upon making the search code naman hahha hindi gumagana.. feeling ko careless mistake lng ako dito..hahah pascan po hehehe salamat po!!! :D

eto po code ko

<?php
include 'connect.php';
if($_GET['q'] && !empty($_GET['q'])) {


$q = $_GET['q'];
$sql = "SELECT * FROM ticket_main WHERE id LIKE '%$q%' OR ticket_no LIKE '%$q%'";
$result = mysqli_query($con,$sql);

if(mysqli_num_rows($result) >0)
{
?>

<div class="col-md-12">
<div class="table-responsive">
<table class="table table-striped">
<h3> Search Result </h3>
<tr>
<th>ID</th>
<th>TICKET NO</th>
<th>DATE and TIME</th>
<th>BRANCH</th>
<th>ISSUE</th>
<th>PRIORITY</th>
<th>TECHNICIAN</th>
<th>SUPERVISOR</th>
<th>ACTION1</th>
<th>ACTION2</th>
<th>ACTION3</th>
<th>TECH</th>
<th>TECH REMARKS</th>
<th>SV</th>
<th>SV REMARKS</th>

</tr>


<?php
while($row=mysqli_fetch_assoc($result))
{

$id = $row['id'];
$ticket_no = $row['ticket_no'];
$date_and_time = $row['date_and_time'];
$branch = $row['branch'];
$issue = $row['issue'];
$priority = $row['fclLastName'];
$technician = $row['fclFirstName'];
$supervisor = $row['supervisor'];
$status = $row['status'];
$Action1 = $row['Action1'];
$Action2 = $row['Action2'];
$Action3 = $row['Action3'];
$tech = $row['tech'];
$tech_remarks = $row['tech_remarks'];
$SV = $row['SV'];
$sv_remarks = $row['sv_remarks'];

?>
<tr>
<td><?php echo $id; ?></td>
<td><?php echo $ticket_no; ?></td>
<td><?php echo $date_and_time; ?></td>
<td><?php echo $branch; ?></td>
<td><?php echo $issue; ?></td>
<td><?php echo $priority; ?></td>
<td><?php echo $technician; ?></td>
<td><?php echo $supervisor; ?></td>
<td><?php echo $status; ?></td>
<td><?php echo $Action1; ?></td>
<td><?php echo $Action2; ?></td>
<td><?php echo $Action3; ?></td>
<td><?php echo $tech; ?></td>
<td><?php echo $tech_remarks; ?></td>
<td><?php echo $SV; ?></td>
<td><?php echo $sv_remarks; ?></td>
<td><a href="editticketinfo.php?edit=<?php echo $id;?>" class="btn btn-primary">Edit</a>
<a href="deleteticket.php.php?delete=<?php echo $id?>" class="btn btn-danger">Delete</a></td>

</tr>
</table>
</div>
</div>

<?php

} else {
echo 'Data Not Found';
}

}
?>


And dun po sa Page ko

<!DOCTYPE html>
<?php include 'connect.php'; ?>
<html>
<title>Republic of Gamers</title>

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/a.css">
<link rel="stylesheet" href="css/b.css">
<link rel="stylesheet" href="css/c.css">
<style>
body {font-family: "Lato", sans-serif}
.mySlides {display: none}
</style>
<head>
<style>
body {
background-image: url("bg.png");
background-repeat: no-repeat;
background-position: right top;
background-attachment: fixed;
}
</style>

<style>
table {
width: 100%;
height: 100%;
font-family: arial, sans-serif;
color: antiquewhite;
border-collapse: collapse;

}

td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}

tr:nth-child(even) {
background-color: #dddddd;
color: black;

}
</style>
</head>
<BODY>
<br>
<br>
<br>
<br>



<div class="search-div" id="search-add-bar">
<div class="col-md-1" id="addUser">
<a href="addticketinfo.php" class="btn btn-primary">
<i class="fa fa-plus" style="color: #dddddd"> Add Ticket</i></a>
</div>
<div id="nav-search" class="col-md-10">
<form>
<form action="search.php" method="GET">
<input type="search" class="form-control" placeholder="Search" name="search" id="search"> <input type="submit" value="Search" />
<div id="here"></div>
<!-- <span class="input-group-addon">-->
<!-- <button type="submit" name="search">-->
<!-- <i class="fa fa-search" aria-hidden="true"></i>-->
<!-- </button>-->
<!-- </span>-->
</form>
</div>
</div>


<?php
$conn = mysql_connect('localhost', 'root', '');
if($conn)
{
if(mysql_select_db('rog_db', $conn))
{
$qry = "SELECT * FROM ticket_main";
$result = mysql_query($qry);
echo "<table border='1'>";
echo "<tr>";
echo "<td>ID</td>";
echo "<td>TICKET NO</td>";
echo "<td>DATE and TIME</td>";
echo "<td>BRANCH</td>";
echo "<td>ISSUE</td>";
echo "<td>PRIORITY</td>";
echo "<td>TECHNICIAN</td>";
echo "<td>SUPERVISOR</td>";
echo "<td>STATUS</td>";
echo "<td>ACTION1</td>";
echo "<td>ACTION2</td>";
echo "<td>ACTION3</td>";
echo "<td>TECH</td>";
echo "<td>TECH REMARKS</td>";
echo "<td>SV</td>";
echo "<td>SV REMARKS</td>";
echo "<td></td>";



echo "</tr>";
while($rows = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>".$rows['id']."</td>";
echo "<td>".$rows['ticket_no']."</td>";
echo "<td>".$rows['date_and_time']."</td>";
echo "<td>".$rows['branch']."</td>";
echo "<td>".$rows['issue']."</td>";
echo "<td>".$rows['priority']."</td>";
echo "<td>".$rows['technician']."</td>";
echo "<td>".$rows['supervisor']."</td>";
echo "<td>".$rows['status']."</td>";
echo "<td>".$rows['Action1']."</td>";
echo "<td>".$rows['Action2']."</td>";
echo "<td>".$rows['Action3']."</td>";
echo "<td>".$rows['tech']."</td>";
echo "<td>".$rows['tech_remarks']."</td>";
echo "<td>".$rows['SV']."</td>";
echo "<td>".$rows['sv_remarks']."</td>";


echo "<td><a href='editticketinfo.php?id=". $rows['id'] ."'>edit</a>
<a href='deleteticket.php?id=". $rows['id'] ."'>delete</a></td>";

echo "</tr>";
}
echo "</table>";
}
else
{
echo "db not found";
}
}
else
{
echo "cannot connect";
}

mysql_close();
?>


<!-- Navbar -->
<div class="w3-top">
<ul class="w3-navbar w3-black w3-card-2 w3-right-align">
<li class="w3-hide-medium w3-hide-large w3-opennav w3-right">
<a class="w3-padding-large" href="javascript:void(0)" onclick="myFunction()" title="Toggle Navigation Menu"><i class="fa fa-bars"></i></a>
</li>
<li><a href="admin.php" class="w3-hover-none w3-hover-text-grey w3-padding-large">PROFILE</a></li>
<li class="w3-hide-small"><a href="index.html" class="w3-padding-large">HOME PAGE</a></li>
<li class="w3-hide-small"><a href="index.html" class="w3-padding-large">ROG REPORT</a></li>
<li class="w3-hide-small"><a href="logout.php" class="w3-padding-large">LOGOUT</a></li>



</div>
</li>
</ul>
</div>
<script>

// Used to toggle the menu on small screens when clicking on the menu button
function myFunction() {
var x = document.getElementById("navDemo");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
} else {
x.className = x.className.replace(" w3-show", "");
}
}

// When the user clicks anywhere outside of the modal, close it
var modal = document.getElementById('ticketModal');
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>



<!-- End Page Content -->
</div>


<!-- Footer -->
<footer class="w3-container w3-padding-64 w3-center w3-opacity w3-black w3-xsmall">

<img src="logo.png" img size="-100px" >


</footer>

<script>

// Used to toggle the menu on small screens when clicking on the menu button
function myFunction() {
var x = document.getElementById("navDemo");
if (x.className.indexOf("w3-show") == -1) {
x.className += " w3-show";
} else {
x.className = x.className.replace(" w3-show", "");
}
}

// When the user clicks anywhere outside of the modal, close it
var modal = document.getElementById('ticketModal');
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
<script>
$(document).ready(function(e)
{
$("#search").on('keyup',function ()
{
$("#here").show();
var x = $(this).val();
$.ajax(
{
type:'GET',
url:'search.php',
data:'q='+x,
success:function (data) {
$("#here").html(data);
$("#here").slideDown('fast');
}
});
});
});
</script>

</body>
</html>
 

Attachments

  • rog.rar
    4 MB · Views: 1
Last edited:
please try mo po i solve yung problema mo through tracing and isolating the thing you've wanted to achieve in this example 'Search activity.
mukhang ang dali lang nang problema mo

mali yung $_GET value mo.

ikaw na magsolve niyan ito clue: mali ang name key ng $_GET variable mo.
 
Back
Top Bottom