我无法让两个 INNER JOINS 工作。当我只使用第一个 INNER JOIN 时正在显示数据,但当我添加第二个 INNER JOIN 时没有显示任何内容。
这是我在网址所在的位置使用的代码:website.com/matchdetails/season/match_id
<?php
$db = new PDO('mysql:host=db.xx.xx;dbname=xx','xx','xx');
$sth = $db->prepare("
SELECT *
FROM
matchdetails AS md
INNER JOIN
players AS p
ON
(p.player_id = md.player_id)
INNER JOIN
matches AS m
ON
(m.match_id = md.match_id)
WHERE (CONCAT_WS('/', season, match_id)) = :season");
$sth->execute(array(':season' => substr($_SERVER['PATH_INFO'], 1)));
foreach($sth as $row) {?>
<?php echo 'Name '. $row['name'] . '<br/>'; ?>
<?php echo 'Goals ', $row['goals'] . '<br/>'; ?>
<?php echo 'Assists ',$row['assists'] . '<br/>'; ?>
<?php echo 'VVO Score ',$row['vvo_score'] . '<br/>' . '<br/>'; ?>
<?php }?>
我的数据库结构是:
表匹配
表匹配详情
桌上玩家