-2

我正在尝试为我的网站设置一个脚本,其中有一段文本

标签会根据我使用的链接而变化,/file.php?s-id=1但我使用的脚本不起作用。数据库名为 ftvo,表名为 seriesdb。出于安全原因,我在下面附上了我的代码片段,只是缺少数据库密码:

<?php
$sId = $_GET['s-id'];
$mysqli = new mysqli("localhost", "root", "userpassword", "ftvo");
$sql = "
   SELECT id, series
   FROM seriesdb
   WHERE id = $sId
   LIMIT 1
";
$result = $mysqli->query($sql);
$s = mysqli_fetch_array($result, MYSQLI_ASSOC);
mysqli_close($mysqli);
?>

<!DOCTYPE html>
<html>
<head>
<title>No Next Episode</title>
<meta charset="utf-8">
</head>
<body>
<h1 style="color:#FF0000">SITE UNDER CONSTRUCTION</h1>
<a href="/"><h3>Home</h3></a>
<p>We apoligise but there is no more episodes of <? $s['series']; ?> currently available. Please check back later.</p>
<hr />
<p>This site is owned by <b>TechXtra Web Services</b></p>
</body>
</html>

我可以回答有关我的 mysql 服务器的任何问题。

提前致谢。

4

2 回答 2

3

改变

<? $s['series']; ?>

<?= $s['series'] ?>

或者

<?php echo $s['series']; ?>
于 2013-08-07T02:02:06.323 回答
1

你在这里忘记echo了:

<p>We apoligise but there is no more episodes of <? echo $s['series']; ?> currently available. Please check back later.</p>

于 2013-08-07T02:00:49.647 回答