如何使用PHP将HTML输入与mysql数据库进行比较? [关闭]

$query = "
SELECT N.N_ID
     , P.P_ID
     , P.P_F_NAME
     , P.P_L_NAME
     , P.P_ADDR
     , NP.VISIT_TIME
     , N.N_LN_NAME
     , N.N_SPEC
     , M.M_DESC
     , NM.M_DOSE 
  FROM NURSE N
     , patient P
     , n_visit_p NP
     , MEDIC M
     , n_provide_m NM 
 WHERE N.N_ID  = NP.N_ID 
   AND P.P_ID  = NP.P_ID 
   AND M.M_ID  = NM.M_ID 
   AND NP.N_ID = NM.N_ID 
   AND NP.P_ID = NM.P_ID
     , **N.N_ID='{$_GET["nurse_id"]}'**;
     ");

 $result = mysqli_query($con,$query);

This is a part of my code, where i tried to compare the HTML input through $_GET.... "nurse_id" is the form name in HTML through which i am receiving input.. I even tried it with $N_ID= $_GET["nurse_id"]" but its not working either way... the result that i am getting is all nurse details but not the specific selected nurse...

It looks like you'll need to use AND instead of the comma.

"... AND NP.P_ID=NM.P_ID AND N.N_ID='".$_GET['nurse_id']."';");

If the nurse id is an integer, you don't need the single quotes:

"... AND NP.P_ID=NM.P_ID AND N.N_ID=".$_GET['nurse_id'].";");

I strongly recommend that you sanitize $_GET values before using them to query the database. Even better, use prepared statements.