Response & lt; html & gt; & lt; head & gt; & nbsp; & lt; title & gt; AnewApplicationforaclassroom & lt; title & gt; & lt; head & gt; & lt; body & gt; & nbsp; & lt; h1 & gt; how does CRMS implement search by entering at least one content in multiple search boxes?
Apply.html
A new Application for a classroom
CRMS-New classroom Entry
2. php
A new Application for a classroom
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 ","");
// Establish a connection through the server locahost. the user name is root and no password is required.
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)
?>
The reason is that the Classroom ID or Course ID cannot be successfully searched. I have written if (! $ Cno) {$ Cno = "% ";}
If (! $ CID) {$ CID = "%";} if it is not specified, use the wildcard character and the LIKE character is used during the query. (if all the LIKE characters in the query are replaced with = characters, the query is successful ). Why? Online, etc!
------ Solution --------------------
Because you use like. Check the mysql manual.