如何在view.php页面

时间:2016-04-25 20:33:33

标签: php

我无法在view.php页面上显示我的帖子说明。

我的代码如下



<?php include("config.php"); ?>
<?php
ob_start();
session_start();
if($_SESSION['name']!='admin'){
  header('location: admin_login.php');
}

?>
<?php
if(isset($_GET['id']))
$id=$_GET['id'];
print_r($id);  die;
?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>view post2</title>
    <link href="admincss/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="admincss/admincustom.css">
  </head>
  <body>
  <div class="full_page">
    <div class="iner_page">
      <h2><span style="">View all data</span></h2>
      <form action="" method="post">
              <table class="tbl3">
                <tr>
                <?php
                $postid=$_GET['post_id'];
                
                $result=(mysql_query("SELECT * from `tbl-post`(post_id) VALUES `$postid`"));
                while ($row=mysql_fetch_row($result)){

                }

                
                ?>
                  <tr>
                    <td><b><span style="color:#000;">Title</span></b></td>
                  </tr>
                    <tr>
                      <td>
                        <span id="view_post_title" style="font-weight: bold; font-size:18px;color:red;"><?php echo $row['post_title']; ?></span>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <img id="view_post_image" class="img-thumbnail" width="304" height="236" src="uplodfile/<?php echo $row['post_image']; ?>">
                      </td>
                    </tr>
                    <tr><td><span style="font-weight: normal; font-size:16px;color:red;">Featchered Images</span></td></tr>
                    <tr>
                      <td><span style="font-weight: bold; font-size:22px;color:#000; ">Description</span></td>
                    </tr>
                    <tr>
                      <td><span id="view_post_description" style="font-weight:normal; font-size:16px;font-size:19px;">
                          <?php echo $row['post_description']; ?>

                      </span></td>
                    </tr>
                    <tr>
                      <td><span style="font-weight: normal; font-size:22px; color:#000;">Catagory</span></td>
                    </tr>
                    <tr>
                      <td>
                      <span id="view_post_catname" style="font-weight: bold; font-size:18px;color:red;">
                          vkssc hvkuv futyoi ylg
                      </span>
                      </td>
                    </tr>
                    <tr>
                      <td><span style="font-weight: normal; font-size:18px; color:#000;">Tag</span></td>
                    </tr>
                    <tr>
                      <td><span id="view_post_tag" style="font-weight: bold; font-size:18px;color:red;">
                       huysrg ulier biurhq9r
                      </span></td>
                    </tr>
                </tr>
                
              </table>
            </form>
    </div>
    <a href="View-Post .php"><button name="" type="button" class="btn btn-default new_view_button" data-dismiss="modal" href="">Close</button></a>
  </div>
  <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
      <script src="js/jquery-1.11.3.min.js"></script>
      <script src="js/bootstrap.min.js"></script>
  </body>
</html>


            
  
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:-1)

检查变量$ row是否为空并且包含您的字段:

var_dump($row)

而不是回声。