-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathschedule_round_1.php
More file actions
44 lines (40 loc) · 1.14 KB
/
Copy pathschedule_round_1.php
File metadata and controls
44 lines (40 loc) · 1.14 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
<?php
$conn=mysqli_connect('localhost','root','','User_Database');
if($conn)
{
$count=mysqli_fetch_array(mysqli_query($conn,'select max(player_id) from player_list'))[0];
$present_serial=0;
if($count%2==0)
{
for($i=1;$i<=($count/2);$i++)
{ $present_serial++;
$id2=$count-$i+1;
$sql="insert into round_1( serial,plyid_1,plyid_2 ) values ($present_serial,$i,$id2) ";
if(mysqli_query($conn,$sql))
echo("Inserted into round_1: Player 1 :".$i." Player 2 : ".$id2);
else
echo mysqli_error($conn);
}
}
else
{ $i;
for($i=1;$i<=($count/2);$i++)
{ $present_serial++;
$id2=$count-$i+1;
$sql="insert into round_1( serial,plyid_1,plyid_2 ) values ($present_serial,$i,$id2) ";
if(mysqli_query($conn,$sql))
echo("Inserted into round_1: Player 1 :".$i." Player 2 : ".$id2);
else
echo mysqli_error($conn);
}
$id2=999;
$present_serial++; //dummy player id
$sql="insert into round_1( serial,plyid_1,plyid_2)values ($present_serial,$i,$id2) ";
if(mysqli_query($conn,$sql))
echo("Inserted into round_1: Player 1 :".$i." Player 2 : ".$id2);
else
echo mysqli_error($conn);
}
}
mysqli_close($conn);
?>