How to implement multiple find boxes just fill in at least one find content to find
Apply.html
<title>A new application for a classroom</title>
Crms-new Classroom Entry
2.php
<title>A new application for a classroom</title>
Crms-new Classroom Entry Results
Create short variable names
$Cno =$_post[' Cno '];
$CID =$_post[' CID '];
if (! $Cno) {$Cno = "%";}
if (! $CID) {$CID = "%";}
if (!GET_MAGIC_QUOTES_GPC ()) {
$Cno = Addslashes ($Cno);
$CID = Addslashes ($CID);
}
$con = mysql_connect ("localhost", "root", "");
Connect via server locahost, user name is root, no password
if (! $con)
{
Die (' Could not connect: '. Mysql_error ());
}
mysql_select_db ("CRMs", $con);
$search _classroom = "SELECT * FROM Use2
WHERE Cno like ' {$Cno} ' and CID like $CID ";
$result = mysql_query ($search _classroom, $con);
while ($row = Mysql_fetch_array ($result))
{
echo $row [' Cno '];
echo $row [' CID '];
echo "
";
}
Mysql_close ($con)
?>
Why this cannot be achieved when the classroom ID or course ID is not filled out, still can successfully search. I have already written if (! $Cno) {$Cno = "%";}
if (! $CID) {$CID = "%";} If you do not fill in the wildcard character, and the query is also used like (if the query as if all to = is successful). Why? Online and so on!
------Solution--------------------
Because you use like. Check out the MySQL manual.