php mysql高尔夫统计页面

时间:2016-02-08 21:05:18

标签: php mysql

我正在创建一个跟踪高尔夫比分并将其返回给用户的网站。每一轮,玩家放入他们的分数,然后我想显示玩家拥有多少分,小鸟,转向架等。每个球场都有洞的值。我需要取得玩家的分数,从par值中算出-1,0,+ 1,+ 2等。之后,我需要弄清楚整个回合中有多少小鸟,草坪,转向架等,并将它们列在桌子上。

有人知道这样做的方法吗?我一直坐在这里思考这个问题已有一段时间了,我无法想到如何做到这一点。

以下是我的询问:

$user = $_GET['user_id']; 
$get_player = "SELECT * 
         FROM users 
         WHERE user_id = '$user'";
$run_player = mysqli_query($con, $get_player); 
$row_player = mysqli_fetch_array($run_player);

$get_rounds = "SELECT *
               FROM user_rounds
               INNER JOIN courses 
               ON user_rounds.course_name=courses.course_name
               WHERE user_id = '".$row_player['user_id']."'";
$run_rounds = mysqli_query($con, $get_rounds);
while($row_rounds = mysqli_fetch_array($run_rounds)) {

然后从这里开始我正在努力为所有这些做数学。我的表格中存储了每个分数以及他们所演奏的课程名称;所以这两个表匹配得很好。

任何帮助将不胜感激!!

编辑

以下是我的数据库结构:

rounds 
CREATE TABLE IF NOT EXISTS `user_rounds` (
`round_id` int(100) NOT NULL AUTO_INCREMENT,
`user_id` int(100) NOT NULL,
`date_played` date NOT NULL,
`user_name` varchar(100) NOT NULL,
`user_last_name` varchar(100) NOT NULL,
`user_username` varchar(100) NOT NULL,
`user_pass` varchar(100) NOT NULL,
`user_email` varchar(100) NOT NULL,
`course_name` varchar(100) NOT NULL,
`tee_played` varchar(100) NOT NULL,
`cor_rating` varchar(100) NOT NULL,
`cor_slope` int(100) NOT NULL,
`hole1` int(5) NOT NULL,
`hole2` int(5) NOT NULL,
`hole3` int(5) NOT NULL,
`hole4` int(5) NOT NULL,
`hole5` int(5) NOT NULL,
`hole6` int(5) NOT NULL,
`hole7` int(5) NOT NULL,
`hole8` int(5) NOT NULL,
`hole9` int(5) NOT NULL,
`hole10` int(5) NOT NULL,
`hole11` int(5) NOT NULL,
`hole12` int(5) NOT NULL,
`hole13` int(5) NOT NULL,
`hole14` int(5) NOT NULL,
`hole15` int(5) NOT NULL,
`hole16` int(5) NOT NULL,
`hole17` int(5) NOT NULL,
`hole18` int(5) NOT NULL,
`totOut` int(10) NOT NULL,
`totIn` int(10) NOT NULL,
`total` int(10) NOT NULL,

courses 
CREATE TABLE IF NOT EXISTS `courses` (
`course_id` int(10) NOT NULL AUTO_INCREMENT,
`c_id` varchar(10) NOT NULL,
`course_name` varchar(50) NOT NULL,
`hole_1_par` varchar(1) NOT NULL,
`hole_2_par` varchar(1) NOT NULL,
`hole_3_par` varchar(1) NOT NULL,
`hole_4_par` varchar(1) NOT NULL,
`hole_5_par` varchar(1) NOT NULL,
`hole_6_par` varchar(1) NOT NULL,
`hole_7_par` varchar(1) NOT NULL,
`hole_8_par` varchar(1) NOT NULL,
`hole_9_par` varchar(1) NOT NULL,
`hole_10_par` varchar(1) NOT NULL,
`hole_11_par` varchar(1) NOT NULL,
`hole_12_par` varchar(1) NOT NULL,
`hole_13_par` varchar(1) NOT NULL,
`hole_14_par` varchar(1) NOT NULL,
`hole_15_par` varchar(1) NOT NULL,
`hole_16_par` varchar(1) NOT NULL,
`hole_17_par` varchar(1) NOT NULL,
`hole_18_par` varchar(1) NOT NULL,
`hole_1_hc_mens` varchar(2) NOT NULL,
`hole_2_hc_mens` varchar(2) NOT NULL,
`hole_3_hc_mens` varchar(2) NOT NULL,
`hole_4_hc_mens` varchar(2) NOT NULL,
`hole_5_hc_mens` varchar(2) NOT NULL,
`hole_6_hc_mens` varchar(2) NOT NULL,
`hole_7_hc_mens` varchar(2) NOT NULL,
`hole_8_hc_mens` varchar(2) NOT NULL,
`hole_9_hc_mens` varchar(2) NOT NULL,
`hole_10_hc_mens` varchar(2) NOT NULL,
`hole_11_hc_mens` varchar(2) NOT NULL,
`hole_12_hc_mens` varchar(2) NOT NULL,
`hole_13_hc_mens` varchar(2) NOT NULL,
`hole_14_hc_mens` varchar(2) NOT NULL,
`hole_15_hc_mens` varchar(2) NOT NULL,
`hole_16_hc_mens` varchar(2) NOT NULL,
`hole_17_hc_mens` varchar(2) NOT NULL,
`hole_18_hc_mens` varchar(2) NOT NULL,
`hole_1_hc_womens` varchar(2) NOT NULL,
`hole_2_hc_womens` varchar(2) NOT NULL,
`hole_3_hc_womens` varchar(2) NOT NULL,
`hole_4_hc_womens` varchar(2) NOT NULL,
`hole_5_hc_womens` varchar(2) NOT NULL,
`hole_6_hc_womens` varchar(2) NOT NULL,
`hole_7_hc_womens` varchar(2) NOT NULL,
`hole_8_hc_womens` varchar(2) NOT NULL,
`hole_9_hc_womens` varchar(2) NOT NULL,
`hole_10_hc_womens` varchar(2) NOT NULL,
`hole_11_hc_womens` varchar(2) NOT NULL,
`hole_12_hc_womens` varchar(2) NOT NULL,
`hole_13_hc_womens` varchar(2) NOT NULL,
`hole_14_hc_womens` varchar(2) NOT NULL,
`hole_15_hc_womens` varchar(2) NOT NULL,
`hole_16_hc_womens` varchar(2) NOT NULL,
`hole_17_hc_womens` varchar(2) NOT NULL,
`hole_18_hc_womens` varchar(2) NOT NULL,

所以第一个将是小鸟等,我正在寻找的是能够将所有的小腿,小鸟,转向架等组合在一起,然后在所有轮次中将它们全部放在一起已经玩过了。

0 个答案:

没有答案