I stuck with this problem for a few days already. The logic of the system i want to develop is here
This is the code for the image
<?php
session_start();
?>
<!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>
<title>Search</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- <link rel="stylesheet" type="text/css" href="style.css"/> -->
</head>
<body>
<form action="process/searchprocess.php" method="GET">
<table width="100%">
<tr>
<th>
Client Ic<br><input type="text" name="client_name" />
</th>
<th>
Client Ic<br><input type="text" name="client_ic" />
</th>
<th>
Client Address <br><input type="text" name="client_add" />
</th>
</tr>
</table>
<table width="100%">
<tr>
<th>
<br><input type="submit" value="Search" align="center" />
</th>
</tr>
</table>
</form>
</body>
</html>
This is my process code
<?php
session_start();
mysql_connect("localhost", "root", "") or die("Error connecting to database: ".mysql_error());
mysql_select_db("waveevo") or die(mysql_error());
?>
<!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>
<title>Search results</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- <link rel="stylesheet" type="text/css" href="style.css"/> -->
<style>
table tr:nth-child(even) {
background-color: #eee;
}
table tr:nth-child(odd) {
background-color:#fff;
}
table th {
background-color: black;
color: white;
}
</style>
</head>
<body>
<?
php
$query = $_GET['client_name'];
$query2 = $_GET['client_ic'];
$query3 = $_GET['client_add'];
if ($query == null && $query2 == null && $query3 == null)
{
echo "Please at least insert one the value";
}
else
{
$query = htmlspecialchars($query);
$query2 = htmlspecialchars($query2);
$query3 = htmlspecialchars($query3);
$query = mysql_real_escape_string($query);
$query2 = mysql_real_escape_string($query2);
$query3 = mysql_real_escape_string($query3);
$raw_results = mysql_query("SELECT * FROM client WHERE ('client_name' LIKE '%".$query."%') OR ('client_ic' LIKE '%".$query2."%') OR ('client_add_1' && ' ' && 'client_add_2' && ' ' && 'client_add_3' && ' ' && 'client_add_4' LIKE '%".$query3."%')") or die(mysql_error());;
if(mysql_num_rows($raw_results) > null){ // if one or more rows are returned do following
while($results = mysql_fetch_array($raw_results)){
?>
<table width="100%">
<tr>
<th>ID</th>
<th>Name</th>
<th>IC</th>
<th>Mobile</th>
<th>Address</th>
<th>Marital Status</th>
<th>Race</th>
<th>Asset Type</th>
<th>Bank</th>
<th>Amount</th>
<th>Nationality</th>
<th>Limit</th>
</tr>
<tr>
<td><?php echo $results["client_id"]; ?></td>
<td><?php echo $results["client_name"]; ?></td>
<td><?php echo $results["client_ic"]; ?></td>
<td><br><?php echo $results["client_mobile_1"]."<br>".$results["client_mobile_2"]."<br>".$results["client_mobile_3"]; ?></td>
<td><?php echo $results["client_add_1"]."<br>".$results["client_add_2"]."<br>".$results["client_add_3"]."<br>".$results["client_city"]."<br>".$results["client_postcode"]; ?></td>
<td><?php echo $results["client_marital_status_id"]; ?></td>
<td><?php echo $results["client_race_id"]; ?></td>
<td><?php echo $results["client_asset_type_id"]; ?></td>
<td><?php echo $results["client_bank_id"]; ?></td>
<td><?php echo $results["amount"]; ?></td>
<td><?php echo $results["client_nationality_id"]; ?></td>
<td><?php echo $results["client_limit"]; ?></td>
</tr>
</table>
<?php
}
}
else{ // if there is no matching rows do following
echo "No results";
}
}
?>
</body>
So I try enter value for client ic, for example 1234, there is no data in the database that match the value that i entered just now but the result still show have, can i know why because i already don't have way to solve this

%characters around your query parameters. MySQL can't make up data, so if you get a result it means it somehow matched.ORwhich means that it will return all rows which match any of the where statements separated with theORso, if you only give itclient_ic = 1234andclient_name='%%'it won't match on the '1234' but it will match on theclient_nameext/mysqlextension was deprecated in 5.5 and has been removed in 7.0 - you should learn to use newer APIs, like PDO or MySQLi.