-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.php
46 lines (36 loc) · 1.13 KB
/
next.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
$capt = $_POST["captain"];
$team = $_POST["teamno"];
//echo $capt.$team;
$servername = "localhost";
$username = "root";
$password = "tubul8794";
$dbname = "SAS";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql1 = "SELECT * FROM list WHERE id = '$team' ";
$result1 = $conn->query($sql1);
$row1=$result1->fetch_assoc();
$sql2= "SELECT * FROM players WHERE Name = '$capt' ";
$result2 = $conn->query($sql2);
$row2=$result2->fetch_assoc();
//$capt1= $row1["captain"];
{
//echo $row1["points"];
//echo $row2["points"];
$sql= "UPDATE list SET captain = '$capt' WHERE id = '$team'";
if($conn->query($sql)===TRUE)
echo "New captain name: ".$capt." for team ".$team."<br>";
$count=$row1["points"]+$row2["points"];
$sql = "UPDATE list SET points = '$count' WHERE id = '$team'";
if($conn->query($sql)===TRUE)
echo "New Points:".$count;
}
echo "</br>"."<a href=drop.html>Click Here to return to bidding!</a>";
echo "</br>"."<a href=fourth.html>Click Here to Display team !</a>";
$conn->close();
?>