Update file users.php
This commit is contained in:
parent
6844b1fbbe
commit
cd59839803
@ -12,9 +12,9 @@ if(isset($_POST['userid']) && isset($_POST['role']) && isset($_POST['accreditati
|
|||||||
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
|
$bdd = connect($dbhost, $dbname, $dbuser, $dbpass);
|
||||||
|
|
||||||
$req = $bdd->prepare("UPDATE users SET role = :role, accreditation = :accreditation WHERE ID = :userid");
|
$req = $bdd->prepare("UPDATE users SET role = :role, accreditation = :accreditation WHERE ID = :userid");
|
||||||
$req->bindParam(':role',$_POST['role']);
|
$req->bindParam(':role',$_POST['role'], PDO::PARAM_INT);
|
||||||
$req->bindParam(':accreditation',$_POST['accreditation']);
|
$req->bindParam(':accreditation',$_POST['accreditation'], PDO::PARAM_INT);
|
||||||
$req->bindParam(':userid', $_POST['userid']);
|
$req->bindParam(':userid', $_POST['userid'], PDO::PARAM_INT);
|
||||||
if ($req->execute()) {
|
if ($req->execute()) {
|
||||||
$status = "Utilisateur mis à jour";
|
$status = "Utilisateur mis à jour";
|
||||||
} else {
|
} else {
|
||||||
@ -148,7 +148,7 @@ if(isset($_POST['userid']) && isset($_POST['role']) && isset($_POST['accreditati
|
|||||||
echo "</select>";
|
echo "</select>";
|
||||||
echo "<select name='role' required>";
|
echo "<select name='role' required>";
|
||||||
foreach($roles as $id => $nom) {
|
foreach($roles as $id => $nom) {
|
||||||
if($row['accreditation'] == $id) {
|
if($row['role'] == $id) {
|
||||||
echo '<option value="' . $id .'" selected>' . $nom . '</option>';
|
echo '<option value="' . $id .'" selected>' . $nom . '</option>';
|
||||||
} else {
|
} else {
|
||||||
echo '<option value="' . $id .'">' . $nom . '</option>';
|
echo '<option value="' . $id .'">' . $nom . '</option>';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user