-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuivi2.php
26 lines (24 loc) · 1.03 KB
/
suivi2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
require_once "controllerUserData.php";
if(isset($_POST['add'])){
$rating = $_POST["rating"];
$livreur=$_SESSION['livreur'];
$req="select * from utilisateur where id=$livreur";
$resultat = mysqli_query($con,$req);
if(mysqli_num_rows($resultat) > 0){
$fetch_data = mysqli_fetch_assoc($resultat);
$score = $fetch_data['score'];
$score = ($score+$rating)/2;
$score = round($score, 2);
$update_otp = "UPDATE utilisateur SET score = $score WHERE id = $livreur";
$update_res = mysqli_query($con, $update_otp);
$numero_cmd=$_SESSION['num'];
$update_otp2 = "UPDATE commande SET rated = 1 WHERE num_c = $numero_cmd";
$update_res2 = mysqli_query($con, $update_otp2);
if($update_res2 && $update_res){
echo "merci pour votre vote redirecting vers home page ...";
header('Location: home.php');
}
}
}
?>