SQL statement syntax $ search1 & quot; SELECTclassroom_id, building_idFROMuse2 & nbsp; WHERE (time {$ time}) & nbsp; AND (building_id {$ building_id }) & nbsql statement writing
$ Search1 = "SELECT classroom_id, building_id FROM use2
WHERE (time = '{$ time }')
AND (building_id = '{$ building_id }')
AND (lesson_id LIKE '$ lesson_id ')";
$ Result1 = mysql_query ($ search1, $ con );
$ Row = mysql_fetch_array ($ result1 );
$ Search2 = "SELECT * FROM classroom2
WHERE (building_id = '{$ building_id }')
AND * NOT IN
(SELECT * FROM classroom2
WHERE (building_id = '{$ building_id }')
AND (classroom_id = '$ {row ['classroom _ id']}') ";
$ Result2 = mysql_query ($ search2 );
While ($ row = mysql_fetch_array ($ result2 ))
{}
Display mysql_fetch_array () expects parameter 1 to be resource, boolean given in D: \ xampp \ htdocs \ search_free2.php
Use2 stores the usage information of some classrooms, including the time used by each class, the room number, and the building.
Now, we are implementing the function of entering the building number and checking the time for the empty room. First, let's look at the information that I entered. see if there are some room-related information in use2, if there is no relevant implementation, there is no problem.
This is a problem if it is not implemented. I want to find out the classrooms with no relevant information first, and then process the classrooms with relevant information. However, if you are looking for a classroom without relevant information, the above error is displayed. please advise!
------ Solution --------------------
$ Result1 = mysql_query ($ search1, $ con) or die (mysql_error ());
$ Result2 = mysql_query ($ search2) or die (mysql_error ());
Are prompted.