我是一名iphone程序员,在php和mysql中并不那么出色。我的问题是,我有一个在线高分系统,在我的所有模式中都有3张桌子。我试图根据来自GET变量的输入来选择表,但它不起作用。这是我在php中的代码。根据GET变量选择表格
$typeGame = isset($_GET['type']) ? $_GET['type'] : "";
$typeGame = mysql_real_escape_string($type);
if ($typeGame === "Sprint") {
$table = "highscoresSprint";
}
else if ($typeGame === "Normal")
{
$table = "highscoresNormal";
}
else
{
$table = "highscoresMarathon";
}
其中typeGame是请求的游戏类型,$ table是表格。
我希望你能帮助我,它就是行不通的。
干杯,乔。
任何错误输出张贴这件事看到的事情吗? 'echo $ _GET ['type']'返回什么?并且url必须是'http://test.com/game?type = Sprint'类似的东西。 – Alex 2012-02-20 19:06:23
echo $ typeGame =? – 2012-02-20 19:08:36
@ Furgas的回答应该这样做 – Alex 2012-02-20 19:09:15