下面是我的 PHP 代码。谁能告诉我如何删除此代码中每个 SQL 条目的超链接?
因为我不希望我的用户点击任何条目然后定向到另一个网页。我只想要一个包含来自我的 sql 数据库的条目的静态表。
非常感谢!
<?
#Get the event id from $_GET
$int_event_id = $_GET["EventID"];
if((int)$int_event_id)
{
$pdo = new PDO('mysql:host=localhost;dbname=clubresults', 'root', '12345678');
#Set Error Mode to ERRMODE_EXCEPTION.
$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$query = $pdo->query("SELECT EventName, Score, Place from results WHERE EventID ='$int_event_id' ORDER By EventID ASC");
$rowset = array();
if ($query) {
while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
// Build array of rows
$rowset[] = $row;
}
// Output header first
$headrow = $rowset[0];
print("<table border=\"1\">\n<tr>\n");
// Use $rowset[0] to write the table heading
foreach ($headrow as $col => $val) {
printf("<th>%s</th>\n", $col);
}
print("</tr>");
// Then output table rows.
// Outer loop iterates over row
foreach ($rowset as $row) {
print("<tr>");
// Inner loop iterates over columns using $col => $val
foreach ($row as $col => $val) {
// We don't know your column names, but substitute the first column (the ID) for FIRSTCOL here
printf("<td><a href=\"index.php?ID=%s\">%s</a></td>\n", $row['EventID'],$val);
}
print("</tr>");
}
}}
print("</table>");
?>