我正在尝试为我的网站设置一个脚本,其中
标签中的一段文字根据我使用/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服务器的任何问题。
提前致谢。
答案 0 :(得分:3)
更改
<? $s['series']; ?>
到
<?= $s['series'] ?>
或
<?php echo $s['series']; ?>
答案 1 :(得分:1)
你忘记了echo
:
<p>We apoligise but there is no more episodes of <? echo $s['series']; ?> currently available. Please check back later.</p>