我有下面的代码,我试图使用 URL 中的参数从我的数据库中获取匹配项。我不断收到错误消息“失败”。网址如下:
http://www.examplesite.com/template.php?eventname=3506
编码:
<?php
require_once("./source/include/membersite_config.php");
if(!$fgmembersite->CheckLogin())
{
$fgmembersite->RedirectToURL("login.php");
exit;
}
// Make a MySQL Connection
...
// Retrieve the variable from the url
if(!empty($_GET['eventname'])) {
$eventname = $_GET['eventname'];
} else {
//set default value for $eventname or maybe output an error because eventname isn't set
echo '<p>', 'something failed', '</p>';
}