2015-02-03 2 views
-1

mysql cant이 데이터를 가져옵니다. 어쩌면 내 쿼리에 문제가 있습니까? 쿼리가 죽기 때문에 덕분에 당신은이처럼 die()mysql_error()를 추가해야 많은mysql이 PHP에서 데이터를 가져 오지 않습니다.

include "../../functions/connect.php"; 
extract($_POST); 


if(isset($add)){ 
$sql = "INSERT INTO `tbl_patients`(`dateadd`,`pfname`,`plname`,`pdob`,`address`,`pgender`,`pbtype`,`pheight`,`pweight`,`fallergy`,`mallergy`) 
    VALUES ('$dateadd','$fname','$lname','$dob','$address','$gender','$bloodtype','$hgt','$wgt','$falrgs','malrgs')"; 
$result = mysql_query($sql) or die("Verification Error"); 
if($result) 
    { 
     $a = mysql_query("SELECT * FROM `tbl_patients` WHERE `pfname` = '$fname' "); 
     $aa = mysql_fetch_array($a); 

     if($a) 
     { 
      $aaa = $aa['patientid']; 
      $sql = "INSERT INTO `tbl_medhistory`(`patientid`, `disease`, `sdate`, `edate`, `tdoctor`, `note`, `active`) VALUES('$aaa','$disease','$sdate','$edate','$doc','$note','$act')"; 
      mysql_query($sql); 
      echo "<script type='text/javascript'>alert('succesfully Registered THANK YOU!')</script>"; 

     } 


    } 
} 
+0

무슨 오류를받을 수 있나요 :

또한 당신은 SQL 주입 또는 때문에 값에 따옴표를 사용하여 오류를 방지하기 위해 SQL에서 사용하기 전에 당신의 가치를 탈출해야 명심? – j08691

+0

나는 모른다. 그것은 검증 에러 인 $ result에서 die를 호출합니다. 난 그 오류를 확인하는 방법을 모르겠다. -_- – EverythingRichardify

+0

'죽기 ("확인 오류 :". mysql_error());'로 변경하고 표시되는 것을 보여줍니다. – Darren

답변

관련 문제