0

当用户在搜索页面上输入sayPatientID然后按下搜索按钮时,我希望它进入数据库并根据PatientID输入的信息提取所有信息。

我试过这个但是没有运气。它返回一个空白的白色屏幕。

<?php
    include 'connect.php';

    $id1 = $_POST['PatientID']; //Text box the user searches in
    $result = mysqli_query($con,"SELECT * FROM PatientRecords WHERE PatientID=$id1");

    while($row = mysqli_fetch_array($result))
    {
        echo 
        $row['PatientID'] . " " . 
        $row['FirstName']. " " . 
        $row['LastName']. " " . 
        $row['DOB']. " " . 
        $row['IDNumber1']. " " . 
        $row['Medication1']. " " . 
        $row['Medication1Dosage']. " " . 
        $row['IDNumber2']. " " . 
        $row['Medication2']. " " . 
        $row['Medication2Dosage']. " " . 
        $row['IDNumber3']. " " . 
        $row['Medication3']. " " . 
        $row['Medication3Dosage']. " " . 
        $row['MedicalNotes'];

        echo "<br />";
    }

    mysqli_close($con);
?>
4

2 回答 2

1
SELECT * FROM PatientRecords WHERE PatientID = $id1
于 2013-03-20T01:02:53.250 回答
0
Your query in wrong, In your query you are assigning :id1 to PatientID in where clause
that is nothing beacsue your id1 is store is in $id1 so use that instead of :id1

您的查询

$result = mysqli_query($con,"SELECT * FROM PatientRecords WHERE PatientID=$id1");
于 2013-03-20T06:49:51.280 回答