I want to search in the database from phpmyadmin, but the resulting search is done in the first column only which mean the result shown the data of the first column only
I tried the below code and the results show only the (college) columns, which is the first column.
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form action="college.php" method="post">
<select name=type>
<option vlaue="college">college</option>
<option vlaue="supervisor">supervisor</option>
<option value="pro_name">prog_name</option>
</select>
<label align='right'>search about</label><br>
<input type="text" name="valueToSearch">
<label align='right'>search</label><br>
<input type="submit" name="search" value="search">
</form><br><br>
<?php
if(isset($_POST['search'])) {
$valueToSearch = $_POST['valueToSearch'];
$query = "SELECT * FROM `programs` WHERE CONCAT(`college`,
'supervisor', 'pro_name') LIKE '%".$valueToSearch."%'";
$search_result = filterTable($query);
} else {
$query = "SELECT * FROM `programs`";
$search_result = filterTable($query);
}
// function to connect and execute the query
function filterTable($query) {
$connect = mysqli_connect("localhost", "root", "", "IAU");
$filter_Result = mysqli_query($connect, $query);
return $filter_Result;
}
?>
<table border="1">
<caption><b>البرامج</b></caption>
<tr>
<th align=right>college</th>
<th align=right>supervisor</th>
<th align=right>prog_name</th>
</tr>
<?php while($row = mysqli_fetch_array($search_result)):?>
<tr>
<td align=right><?php echo $row['college'];?></td>
<td align=right><?php echo $row['supervisor'];?></td>
<td align=right><?php echo $row['prog_name'];?></td>
</tr>
<?php endwhile;?>
</table>
</body>
</html>
the result for the above code is for the first column only while I want the result for each columns