我遇到了一個難以解決的問題。我有一個顯示視頻教程的系統。我的代碼顯示視頻名稱(eNISATQuestion)和視頻鏈接(eNISATVideo)作爲一個href。在表中將兩個hrefs顯示爲單獨的列
我想添加另一列來顯示鏈接到與下面部分具有相似佈局的評級頁面。
<tr>
<td>
<a href='{$row['eNISATVideo']}'>{$row['eNISATQuestion']}</a>
</td>
</tr>
使用值(eNISATRateRef)和(eNISATRating)。
在此先感謝
<?php
session_start();
include_once 'dbconnect.php';
if (!isset($_SESSION['user'])) header("Location: index.php");
$res = mysql_query("SELECT * FROM users WHERE user_id=".$_SESSION['user']);
$userRow = mysql_fetch_array($res);
$userID = $_SESSION['user'];
$query = "SELECT eNISATQuestion, eNISATVideo, eNISATRateRef, eNISATRating FROM enisatquestion INNER JOIN enisatanswer WHERE
enisatanswer.eNISATID = enisatquestion.eNISATID AND user_id =
$userID AND eNISAT_watch = 1";
$result = mysql_query($query);
/* A default message if the query fails or there are no records */
$enisatquestion='<h2>Sorry, there are no records</h2>';
if($result) {/* if there is a recordset, proceed and generate html table */
$enisatquestion = "<table >";
while ($row = mysql_fetch_assoc($result)) {
**$enisatquestion .= "<tr><td><a href='{$row['eNISATVideo']}'>{$row['eNISATQuestion']}</a></td></tr>";**
}
$enisatquestion .= "</table>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome - <?php echo $userRow['username']; ?></title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="header">
<div id="left">
<label>NHSCT eNISAT Tutorials</label>
</div>
<div id="right">
<div id="content">
Welcome <?php echo $userRow['forename']; ?> <a href="home.php?home">Return to Homepage</a> <a
href="logout.php?logout">Sign Out</a>
</div>
</div>
<br>
<br>
<br>
<br>
<p align="center"><img src="title.jpeg" width="400"height="100" alt="title.jpeg">
<br>
<br>
<center>
<h2>Click on the each link to open your tutorial in Windows Media Player<h2>
<br>
<?php
/* output the html table here, below your header */
echo $enisatquestion;
/* If the query failed then the default gets displayed */
?>
</div>
</body>
</html>
請在論壇的底部添加你的感謝信,不要在代碼示例之前添加,並且可能會移動你的評論,以便首先討論代碼示例,然後討論最終的問題。這篇文章已被標記。 – blamb
我會記住@布里安托馬斯在未來謝謝澄清 – scubbastevie