我有一个玩家页面,它返回玩家列表并为您提供一些选项。一个是编辑,另一个是统计。可以预见,编辑页面会将您带到一个表单,您可以在其中编辑球员信息,如姓名,而统计数据页面仅显示主要来自其他表格的与该球员有关的统计数据(例如玩过的游戏)。目前这是用于获取统计信息的代码片段:
if (isset($_POST['action']) and $_POST['action'] == 'Stats')
{
include $_SERVER['DOCUMENT_ROOT'] . '/statsite/includes/db.inc.php';
try
{
$sql = 'SELECT id, user.usertitle as name, role, aggression, position, bowlstyle, cricket_players.username, link FROM cricket_players INNER JOIN user ON cricket_players.username = user.userid WHERE id = :id';
$s = $pdo->prepare($sql);
$s->bindValue(':id', $_POST['id']);
$s->execute();
}
catch (PDOExecption $e)
{
$error = 'Error retrieving player details';
include 'players.html.php';
exit();
}
$row = $s->fetch();
$pageTitle = 'View Stats';
$name = $row['name'];
$aggression = $row['aggression'];
$position = $row['position'];
$role = $row['role'];
$bowlstyle = $row['bowlstyle'];
$link = $row['link'];
$username = $row['username'];
$id = $row['id'];
include 'stats.html.php';
exit();
}
如果我点击统计按钮一切正常,但地址栏只有 /? 在玩家页面地址的末尾。有什么方法可以让它显示诸如 /stats?id=1 之类的东西,以便可以直接链接?