Created
September 29, 2020 16:43
-
-
Save Domin8-IPTV/4e0f2b5c19badfc2dfdb9e2cecd9e6eb to your computer and use it in GitHub Desktop.
insert weekly score
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// MADE BY M4UNDY | |
// ENTER SHOOTERS WEEKLY SCORES INTO MYSQL DATABASE | |
$shooter = mysqli_real_escape_string($link, $_POST['shooter']); | |
$values = []; | |
foreach ($_POST['week_score'] as $key => $score) { | |
$score = trim(mysqli_real_escape_string($link, $score)); | |
if (!empty($score)) { | |
$values[] = "('$shooter','$key','$score')"; | |
} | |
} | |
if (!empty($values)) { | |
$values = implode (' , ', $values); | |
$sql = "INSERT INTO scores (shooter, week_num, week_score) VALUES $values"; | |
mysqli_query($link, $sql); | |
} | |
mysqli_close($link); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment