Today, when writing a question-answering system, write a code like this:
<?PHPSession_Start();$db=Mysqli_connect(' localhost ', ' root ', ' root ', ' QA ');$tname=$_post[' Teacher '];$q= "Select Schedule,place from time where Tname= '$tname' and Sname is null ';$arr=Mysqli_query($db,$q);Echo"You have selected".$tname." Teacher "." <br/> Please continue to select the moment: "." <br/> ";><table border= "1" cellspacing= "0" > <tr> <th> time:</th> <th> location: </th> ; </tr> <?PHP while($result=Mysqli_fetch_assoc($arr)) { ?> <tr> <td><?phpEcho $result[' Schedule '];?></td> <td><?phpEcho $result[' Place '];?></td> </tr> <?php}?> </table> <form method= "POST" action= "stime1.php" >the time you choose is:<input type= "datetime" name= "Time"/>your question is:<textarea name= "question" ></textarea> <input type= "Submit" name= "sure" value= "OK"/></form>
is to select a teacher has not been selected time period, such a period of time can be displayed on the page for the new students to choose, but the page shows nothing, but the database has a matching condition of the existence of data items, and then I first copy and paste the SQL statement into the database run, showing that the query results are empty, Then I searched the internet and found in MySQL database sometimes is null does not work, the following is Baidu to say:
Finally, the sname is null changed to Sname= ', the successful detection of the required results, although a small knowledge point, but still remember, lest later for this small mistake waste time.
Null value problem in MySQL