Response & lt; html & gt; & lt; head & gt; & nbsp; & lt; title & gt; AnewApplicationforaclassroom & lt;/title & gt; & lt; /How to 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 = "% ";}
$ 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 );
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.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.