I have successfully inserted multiple values(name) but I can't display the value.It shows the error "Warning: Undefined array key "SS_scheduleWorkersName" in C:\xampp\htdocs\tfas\SS_ViewScheduleShift.php on line 51".Database Image
Attached image is the database structure and here is the code:
<?php
$mysqli = mysqli_connect("localhost", "root", "", "tfasTest");
if ($mysqli-> connect_error) {
die("Connection failed:". $mysqli-> connect_error);
}
$sql = "SELECT * from staff_schedule";
$result = $mysqli-> query($sql);
while($user_data = $result-> fetch_assoc()) {
echo "<tr>";
echo "<td>".$user_data['SS_scheduleWorkshift']."</td>";
echo "<td>".$user_data['SS_scheduleWorkersName']."</td>"; //HERE IS THE ERROR
echo "<td>".$user_data['SS_scheduleWorkcell']."</td>";
echo "<td>".$user_data['SS_scheduleDate']."</td>";
echo "</tr>";
}
?>
CodePudding user response:
The spelling is wrong It should be capital 'S' according to database image.
It should be;
<td>".$user_data['SS_ScheduleWorkersName']."</td>
CodePudding user response:
Replace this $user_data['SS_ScheduleWorkersName']