链接未出现在我的页面上 [英] Link isn't appearing on my page

查看:120
本文介绍了链接未出现在我的页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用下面的代码在我的页面上添加一个链接但由于某种原因它没有显示,我将该区域设置为粗体,这一切对我来说都是正确的。我提出了整段代码,因为我不确定它是否与我用粗体输入的代码之外的代码有关。

 <?php session_start();?> 
<!doctype html>
< html>
< head>
< meta charset =UTF-8>
< title>论坛< / title>
< link href =styles.css =stylesheettype =text / css>
< script> var __adobewebfontsappname __ =dreamweaver< / script>
< script src =http://use.edgefonts.net/source-sans-pro:n6:default.jstype =text / javascript>< / script>

< / head>

< body>
< div id =wrapper>
< header id =top>
< h1> ITSize< / h1>
< nav id =mainnav>
< ul>
< li>< a href =Index.php>主页< / a>< / li>
< li>< a href =Fourth Page.html>注册< / a>< / li>
< li>< a href =Second Page.html>修改< / a>< / li>
< li>< a href =Forum.php>论坛< / a>< / li>
< / ul>
< / nav>
< / header>
< article id =main>
< br>
< br>
<?php
include_once(DBconnect.php);
$ cid = $ _GET ['cid'];

** if(isset($ _ SESSION ['uid'])){
$ logged =|< a href ='create_topic.php?cid =。$ cid。 '>点击此处创建主题< / a>;
} else {
$ logged =|请登录以在此论坛中创建主题; **
}

$ sql =SELECT id FROM categories WHERE id ='。$ cid。'LIMIT 1;
$ res = mysql_query($ sql)或die(mysql_error());
if(mysql_num_rows($ res)== 1){
$ sql2 =SELECT * FROM topics WHERE category_id ='。$ cid。'ORDER BY topic_reply_date DESC;
$ res2 = mysql_query($ sql2)或die(mysql_error());
if(mysql_num_rows($ res2)> 0){
$ topics。=< table width ='100%'style ='border-collapse:collapse;'>;
$ topics。=< tr>< td colspan ='3'< a href ='Forum.php'>返回论坛< / a>。$ logged。< / td> ;< / TR>中;
$ topics。=< tr style ='background-color:#ddddd;'>< td>主题标题< / td>< td width ='65'align ='center'>回复< / td>< td width ='65'align ='center'> Views< / td< / tr>;
while($ row = mysql_fetch_assoc($ res2)){
$ tid = $ row ['id'];
$ title = $ row ['topic_title'];
$ views = $ row ['topic_views'];
$ date = $ row ['topic_date'];
$ creator = $ row ['topic_creator'];
$ topics。=< tr>< td>< a href ='view_topic.php?cid =。$ cid。& tid =。$ tid。>。$标题。< / a>< spa class ='post_info'>发布者:。$ creator。on。$ date。< / span>< / td>< td align =' center'> 0< / td>< td align ='center'>。$ views。< / td>< / tr>;
$ topics。=< tr>< td colspan ='3'>< / td>< / tr>;
}
$ topics。=< / table>;
} else {
echo< p>此类别中没有主题< / p>< br>;
echo< a href ='Forum.php'>返回论坛页面< / a>< br>< br>;
}
}
else {
echo< p>您正在尝试查看不存在的类别< / p>< br>;
echo< a href ='Forum.php'>返回论坛页面< / a>< br>< br>;

}

?>

< / article>
< aside id =sidebar>


< / aside>
< footer>< a href =Third Page.html>我的帐户< / a>
< / footer>
< / div>
< / body>
< / html>


解决方案

阅读完整个代码后:P发现了一些标记错误:这个片段中的所有错误都被删除了。
现在它应该可以正常工作。

 <?php session_start(); ?> 
<!doctype html>
< html>
< head>
< meta charset =UTF-8>
< title>论坛< / title>
< link href =styles.css =stylesheettype =text / css/>
< script> var __adobewebfontsappname __ =dreamweaver; < /脚本>
< script src =http://use.edgefonts.net/source-sans-pro:n6:default.jstype =text / javascript>< / script>
< / head>
< body>
< div id =wrapper>
< header id =top>
< h1> ITSize< / h1>
< nav id =mainnav>
< ul>
< li>< a href =Index.php>主页< / a>< / li>
< li>< a href =Fourth Page.html>注册< / a>< / li>
< li>< a href =Second Page.html>修改< / a>< / li>
< li>< a href =Forum.php>论坛< / a>< / li>
< / ul>
< / nav>
< / header>
< article id =main>
< br />
< br />
<?php
require_once(DBconnect.php);
$ cid = $ _GET ['cid'];

if(isset($ _ SESSION ['uid'])){
$ logged =|< a href ='create_topic.php?cid =。$ cid。' >点击此处创建主题< / a>;
} else {
$ logged =|请登录以在此论坛中创建主题;
}

$ sql =SELECT id FROM categories WHERE id ='。$ cid。'LIMIT 1;
$ res = mysql_query($ sql)或die(mysql_error());
if(mysql_num_rows($ res)== 1){
$ sql2 =SELECT * FROM topics WHERE category_id ='。$ cid。'ORDER BY topic_reply_date DESC;
$ res2 = mysql_query($ sql2)或die(mysql_error());
if(mysql_num_rows($ res2)> 0){

$ topics =< table width ='100%'style ='border-collapse:collapse;'> ;
$ topics。=< tr>
< td colspan ='3'>
< a href ='Forum.php'>返回论坛< / a> ;。$ logged。< / td>
< / tr>;
$ topics。=< tr style ='background-color:#ddddd;'>
< td>主题标题< / td>
< td width = '65 'align ='center'>回复< / td>
< td width ='65'align ='center'>视图< / td>
< / tr>;
while($ row = mysql_fetch_array($ res2)){
$ tid = $ row ['id'];
$ title = $ row ['topic_title'];
$ views = $ row ['topic_views'];
$ date = $ row ['topic_date'];
$ creator = $ row ['topic_creator'];
$ topics。=< tr>
< td>< a href ='view_topic.php?cid =。$ cid。& tid =。$ tid。> ;。$ title。< / a>
< span class ='post_info'>发布者:。$ creator。on。$ date。< / span>
< / td>
< td align ='center'> 0< / td>
< td align ='center'>。$ views。< / td>
< / tr>;
$ topics。=< tr>
< td colspan ='3'>& nbsp;< / td>
< / tr>;
}
$ topics。=< / table>;

echo $ topics;

}其他{
echo< p>此类别中没有主题< / p>< br>;
echo< a href ='Forum.php'>返回论坛页面< / a>< br>< br>;
}
}
else {
echo< p>您正在尝试查看不存在的类别< / p>< br>;
echo< a href ='Forum.php'>返回论坛页面< / a>< br>< br>;
}

?>

< / article>
< aside id =sidebar>
< / aside>
< footer>< a href =Third Page.html>我的帐户< / a>
< / footer>
< / div>
< / body>
< / html>

编辑
代码:已更新。


I'm trying to add a link onto my page with the code below but for some reason it isn't showing up, I've put the area in bold and it all looks correct to me. I presented the whole piece of code as I wasn't sure if it was something to do with the code outside of the bit I have put in bold.

<?php session_start();?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Forum</title>
<link href="styles.css" rel="stylesheet" type="text/css">
<script>var __adobewebfontsappname__="dreamweaver"</script>
<script src="http://use.edgefonts.net/source-sans-pro:n6:default.js" type="text/javascript"></script>

</head>

<body>
<div id="wrapper">
  <header id="top">
    <h1>ITSize</h1>
    <nav id="mainnav">
      <ul>
        <li><a href="Index.php">Home</a></li>
        <li><a href="Fourth Page.html">Register</a></li>
        <li><a href="Second Page.html">Revise</a></li>
        <li><a href="Forum.php">Forum</a></li>
      </ul>
    </nav>
  </header>
  <article id="main">
  <br>
  <br>
 <?php 
 include_once("DBconnect.php");
 $cid= $_GET['cid'];

 **if (isset($_SESSION['uid'])){
     $logged= " | <a href='create_topic.php?cid=".$cid."'>Click here to create a topic</a>";
 }else{
     $logged = " | Please log in to create topics in this forum";**
 }

 $sql = "SELECT id FROM categories WHERE id='".$cid."' LIMIT 1";
 $res = mysql_query($sql) or die(mysql_error());
 if (mysql_num_rows($res) ==1){
     $sql2 = "SELECT * FROM topics WHERE category_id='".$cid."' ORDER BY topic_reply_date DESC";
     $res2 = mysql_query($sql2) or die(mysql_error());
     if (mysql_num_rows($res2)>0){
         $topics .= "<table width='100%' style='border-collapse: collapse;'>";
         $topics .= "<tr><td colspan='3'<a href='Forum.php'>Return To Forum</a>".$logged."</td></tr>";
         $topics .= "<tr style='background-colour: #dddddd;'><td>Topic Title</td><td width='65' align='center'>Replies</td><td width='65' align='center'>Views</td</tr>";
         while ($row = mysql_fetch_assoc($res2)){
         $tid = $row['id'];
         $title = $row['topic_title'];
         $views = $row['topic_views'];
         $date = $row['topic_date'];
         $creator =$row['topic_creator'];
         $topics .= "<tr><td><a href='view_topic.php?cid=".$cid."&tid=".$tid.">".$title."</a><spa class='post_info'>Posted by:".$creator." on ".$date."</span></td><td align='center'>0</td><td align='center'>".$views."</td></tr>";
         $topics .="<tr><td colspan='3'></td></tr>";
         }
     $topics .="</table>";
     }else{
         echo"<p> There are no topics in this category yet</p><br>";
     echo "<a href='Forum.php'>Return To Forum Page</a><br><br>";
     }
 }
 else{
     echo"<p> You are trying to view a category that does not exist</p><br>";
     echo "<a href='Forum.php'>Return To Forum Page</a><br><br>";

 }

 ?>

 </article>
  <aside id="sidebar">


</aside>
  <footer><a href="Third Page.html">My Account</a>
  </footer>
</div>
</body>
</html>

解决方案

after reading whole code :P found some markup errors :) .

in this snippet these all errors are removed .. now it should work fine .

<?php session_start(); ?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Forum</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<script>var __adobewebfontsappname__="dreamweaver"; </script>
<script src="http://use.edgefonts.net/source-sans-pro:n6:default.js" type="text/javascript"></script>
</head>
<body>
<div id="wrapper">
  <header id="top">
    <h1>ITSize</h1>
    <nav id="mainnav">
      <ul>
        <li><a href="Index.php">Home</a></li>
        <li><a href="Fourth Page.html">Register</a></li>
        <li><a href="Second Page.html">Revise</a></li>
        <li><a href="Forum.php">Forum</a></li>
      </ul>
    </nav>
  </header>
  <article id="main">
  <br />
  <br />
<?php 
 require_once("DBconnect.php");
 $cid = $_GET['cid'];

 if (isset($_SESSION['uid'])){
     $logged = " | <a href='create_topic.php?cid=".$cid."'>Click here to create a topic</a>";
 }else{
     $logged = " | Please log in to create topics in this forum";
 }

 $sql = "SELECT id FROM categories WHERE id='".$cid."' LIMIT 1";
 $res = mysql_query($sql) or die(mysql_error());
 if (mysql_num_rows($res) == 1){
     $sql2 = "SELECT * FROM topics WHERE category_id='".$cid."' ORDER BY topic_reply_date DESC";
     $res2 = mysql_query($sql2) or die(mysql_error());
     if (mysql_num_rows($res2)>0){

         $topics  = "<table width='100%' style='border-collapse: collapse;'>";
         $topics .= "<tr>
                        <td colspan='3'>
                            <a href='Forum.php'> Return To Forum  </a>".$logged."</td>
                     </tr>";
         $topics .= "<tr style='background-colour: #dddddd;'>
                      <td>Topic Title</td>
                      <td width='65' align='center'>Replies</td>
                      <td width='65' align='center'>Views</td>
                    </tr>";
         while ($row = mysql_fetch_array($res2)){
         $tid     = $row['id'];
         $title   = $row['topic_title'];
         $views   = $row['topic_views'];
         $date    = $row['topic_date'];
         $creator = $row['topic_creator'];
         $topics .= "<tr>
                        <td> <a href='view_topic.php?cid=".$cid."&tid=".$tid.">".$title."</a>
                             <span class='post_info'>Posted by:".$creator." on ".$date."</span>
                        </td>
                        <td align='center'>0</td>
                        <td align='center'>".$views."</td>
                      </tr>";
         $topics .="<tr>
                        <td colspan='3'>&nbsp;</td>
                    </tr>";
         }
     $topics     .="</table>";

     echo $topics;

     }else{
         echo"<p> There are no topics in this category yet</p><br>";
     echo "<a href='Forum.php'>Return To Forum Page</a><br><br>";
     }
 }
 else{
     echo"<p> You are trying to view a category that does not exist</p><br>";
     echo "<a href='Forum.php'>Return To Forum Page</a><br><br>";
 }

 ?>

 </article>
  <aside id="sidebar">
  </aside>
  <footer><a href="Third Page.html">My Account</a>
  </footer>
</div>
</body>
</html>

EDIT Code : Updated .

这篇关于链接未出现在我的页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆