-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathschedule_round_3.php
More file actions
71 lines (65 loc) · 2.4 KB
/
Copy pathschedule_round_3.php
File metadata and controls
71 lines (65 loc) · 2.4 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
$conn=mysqli_connect('localhost','root','','User_Database');
if($conn)
{ $result_d=mysqli_query($conn,"select * from player_list where state='alive' order by player_id desc");
$result_a=mysqli_query($conn,"select * from player_list where state='alive' order by player_id asc");
$count=mysqli_num_rows($result_a);
$present_serial=0;
if($count%2==0)
{ $idlast=mysqli_fetch_assoc($result_d)['player_id'];
$idlast2=mysqli_fetch_assoc($result_d)['player_id'];
while($row_a=mysqli_fetch_assoc($result_a))
{ $row_d=mysqli_fetch_assoc($result_d);
$present_serial++;
if($present_serial==$count/2)
{ echo "here";
$sql="insert into round_3( serial,plyid_1,plyid_2 ) values ($present_serial,$idlast2,$idlast) ";
if(mysqli_query($conn,$sql))
echo("<br>Inserted into round_3: Player 1 :".$idlast2." Player 2 : ".$idlast);
else
echo mysqli_error($conn);
break;
}
$id1=$row_a['player_id'];
$id2=$row_d['player_id'];
$sql="insert into round_3( serial,plyid_1,plyid_2 ) values ($present_serial,$id1,$id2) ";
if(mysqli_query($conn,$sql))
echo("<br>Inserted into round_3: Player 1 :".$id1." Player 2 : ".$id2);
else
echo mysqli_error($conn);
}
}
else
{ $idlast=mysqli_fetch_assoc($result_d)['player_id'];
$idlast2=mysqli_fetch_assoc($result_d)['player_id'];
while($row_a=mysqli_fetch_assoc($result_a))
{ $row_d=mysqli_fetch_assoc($result_d);
$present_serial++;
if($present_serial==($count/2)-0.5)
{ echo "here";
$sql="insert into round_3( serial,plyid_1,plyid_2 ) values ($present_serial,$idlast2,$idlast) ";
if(mysqli_query($conn,$sql))
echo("<br>Inserted into round_3: Player 1 :".$idlast2." Player 2 : ".$idlast);
else
echo mysqli_error($conn);
$present_serial++;
$id1=$row_a['player_id'];
$id2=999;
$sql="insert into round_3(serial,plyid_1,plyid_2) values ($present_serial,$id1,$id2)";
if(mysqli_query($conn,$sql))
echo("<br>Inserted into round_3: Player 1 :".$id1." Player 2 : ".$id2);
else
echo mysqli_error($conn);
break;
}
$id1=$row_a['player_id'];
$id2=$row_d['player_id'];
$sql="insert into round_3( serial,plyid_1,plyid_2 ) values ($present_serial,$id1,$id2) ";
if(mysqli_query($conn,$sql))
echo("<br>Inserted into round_3: Player 1 :".$id1." Player 2 : ".$id2);
else
echo mysqli_error($conn);
}
}
}
?>