Merge pull request 'batch_insert.php: indentation looks better now.' (#9) from Hui-IndentCode into master

Reviewed-on: http://121.4.94.30:3000/mrlan/LRR/pulls/9
Hui-Bug337
mrlan 2021-07-24 10:31:25 +08:00
commit 8714a738d7
1 changed files with 5 additions and 5 deletions

View File

@ -36,13 +36,13 @@ $user = explode(' ', $source2);
for($index=0; $index < count($user); $index++) {
$result = mysqli_query($conn, "SELECT * FROM `students_data` WHERE Student_ID='$user[$index]'");
if (mysqli_num_rows($result) < 1) {
if (! mysqli_query($conn, "REPLACE INTO `students_data`(`Student_ID`, `Passport_Number`) VALUES('$user[$index]', '')" ) ) {
if (! mysqli_query($conn, "REPLACE INTO `students_data`(`Student_ID`, `Passport_Number`) VALUES('$user[$index]', '')" ) ) {
echo "SQL Error: " . $sql_stmt . "<br>" . mysqli_error($conn);
} else {
echo "<p>Student number $user[$index] added.</p>";
}
} else {
echo "<p>Student number $user[$index] added.</p>";
}
} else {
echo "<p><b>Student number $user[$index] already exists.</b></p>";
echo "<p><b>Student number $user[$index] already exists.</b></p>";
}
}