Ich habe in meiner PHP-Datei folgende Fehlermeldung:mysqli_fetch_array() erwartet 1 Parameter MySQLi_Result wird
Notice: Undefined index: q in C: \ xampp \ htdocs \ medphil \ getpatient.php on line 22
Warnung: mysqli_fetch_array() erwartet 1 Parameter in C MySQLi_Result, boolean gegeben werden: \ xampp \ htdocs \ medphil \ getpatient.php on line 46
dies ist mein Code bitte helfen Sie mir zu löse dieses
<!DOCTYPE html>
<html>
<head>
<style>
table {
width: 100%;
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
padding: 5px;
}
th {text-align: left;}
</style>
</head>
<body>
<?php
$q = intval($_GET['q']);
$con = mysqli_connect('localhost','root','','medphil');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con, "medphil");
$sql="SELECT * FROM patients WHERE id = '".$q."'";
$result = mysqli_query($con,$sql);
echo "<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>username</th>
<th>password</th>
<th>dateofbirth</th>
<th>email</th>
<th>Patientaddress</th>
<th>LastLDNId</th>
</tr>";
while($row = mysqli_fetch_array($result,true)) {
echo "<tr>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "<td>" . $row['username'] . "</td>";
echo "<td>" . $row['password'] . "</td>";
echo "<td>" . $row['dateofbirth'] . "</td>";
echo "<td>" . $row['email'] . "</td>";
echo "<td>" . $row['Patientaddress'] . "</td>";
echo "<td>" . $row['LastLDNId'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
</body>
</html>
Wie Ihre URL aussieht? Gibt es einen Param 'q'? – C2486
'Hinweis: Undefinierter Index: q' sollte Ihnen alles sagen, was Sie wissen müssen. Warum ist 'q' nicht gesetzt? – chris85