2011-11-22 151 views
0

上我有一个PHP的简单的HTML页面,如下所示:差异网页本地主机和主机服务器

<!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> 
<title>Articles 'n' More::Articles</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<meta name="description" content="Articles, Management , english, computers, sharepoint, wp7, bio technology, nano technology, c#"> 
<meta name="keywords" content="Articles, Management , english, computers, sharepoint, wp7, bio technology, nano technology, c#"> 
<link rel="stylesheet" type="text/css" href="CSS/Style.css" /> 
</head> 

<body> 
<table border="1" width="100%"> 
<tr id="header" > 
       <td height="30%" width="100%" colspan="3"> 
<?php include("Header.php"); ?> 
       </td> 
      </tr> 
      <tr id="body"> 
       <td width="15%" valign="top" align="left"> 
        <table width="100%" border="3" align="left"> 
         <tr ><td> 
<?php include("LeftPanel.php"); ?> 
        </td> 
        </tr> 
        </table> 
       </td> 
       <td width="75%" valign="top"> 
        <!--Articles--> 
        <?php 
         $articlePerPage="10"; 
         $subcatID = $_GET['subcatid']; 
         $curPageId = $_GET['pageId']; 
         $nextPageId=$curPageId+1; 
         $prevPageId=$curPageId-1; 
         $con=mysql_connect('localhost','root',''); 
           if(!$con) 
           { 
            die('Could not connect: ' . mysql_error()); 
           }  

           mysql_select_db("articles_db",$con); 

           $query=""; 
           $queryCount=""; 

           if($subcatID == "0") 
           { 
           $queryCount="select count(1) total from tbl_articles"; 
           //echo "QueryCount is".$queryCount; 
           } 
           else 
           { 
           $queryCount="select count(1) total from tbl_articles where SUBCATEGORY_ID=".$subcatID;        
           } 
           $resultCount= mysql_query($queryCount); 
           $rowCount = mysql_fetch_array($resultCount); 
           $totlaArticles= $rowCount['total'] ; 
           //echo 'total articles'.$totlaArticles; 

           if($subcatID == "0") 
           { 
            $query="select * from (SELECT ARTICLE_ID,TITLE,CONTENT,POSTED_ON,POSTED_BY FROM TBL_Articles order by POSTED_ON desc limit ".$articlePerPage*$curPageId.") sub order by POSTED_ON asc limit ".$articlePerPage; 
            //echo $query; 
           } 
           else 
           { 
            $query="select * from (SELECT ARTICLE_ID,TITLE,CONTENT,POSTED_ON,POSTED_BY FROM TBL_Articles where SUBCATEGORY_ID=".$subcatID." order by POSTED_ON desc limit ".$articlePerPage*$curPageId.") sub order by POSTED_ON asc limit ".$articlePerPage; 
           } 
           $result = mysql_query($query); 
        ?> 

        <table width="100%"> 
         <tr id="repeatingRow" valign="top"> 
          <td width="100%"> 
          <?php 

            $count=0; 
           while($row = mysql_fetch_array($result)) 
            { 
            $id= $row['ARTICLE_ID'] ; 
            $title= $row['TITLE'] ; 
            $content= $row['CONTENT'] ; 
$count=$count+1; 
            if(strlen($content)< 110) 
             { 
              $content=substr($content,0,strlen($content)); 
             } 
             else 
              { 
             $content=substr($content,0,100); 
             } 
            $postedon=$row['POSTED_ON'] ; 
            $author = $row['POSTED_BY'] ; 

          ?> 

           <table width="100%"> 
            <tr> 
             <th width="100%" colspan="3"> 
      <a href="ShowArticle.php?articleid= <?php echo $id ; ?>&title=<?php echo $title ; ?>"><?php echo $title ; ?></a></th> 
            </tr> 
            <tr > 
            <h6> 
             <td width="30%" align="left"><img src="Images/account.png" /><?php echo $author ; ?></td> 
             <td width="30%" align="left"><img src="Images/clock.png" /><?php echo $postedon ; ?></td> 
             <td width="40%" align="left"><img src="Images/folder.png" />General</td> 
             </h6> 
            </tr> 
            <tr> 
             <td width="100%" colspan="3"><br/><?php echo $content ;?><br /> 
             <hr color="#49a6e1"> 
             </td> 
            </tr> 
           </table> 
           <?php 
            } 
           ?> 
                  </td> 
         </tr> 
         <tr> 
         <td align="center"> 
         <b> 
          <?php 
          //echo $subcatID; 
          //echo ("<a href='Articles.php?subcatid=".$subcatID."&pageId=".$prevPageId."'>Previous</a>"); 
           if($curPageId>1) 
           { 
            echo ("<a href='Articles.php?subcatid=".$subcatID."&pageId=".$prevPageId."'>Previous</a>"); 
            //echo ("<a href='Articles.php'>Previous</a>"); 
           } 
          ?> 
         </b> 
         </td> 
         <td> 
         <b> 
          <?php 
           if($totlaArticles/($curPageId*10)>1) 
           { 
            echo ("<a href='Articles.php?subcatid=".$subcatID."&pageId=".$nextPageId."'>Next</a>"); 
            //echo "<a href='Articles.php?subcatid='".echo $subcatID."@pageId= ".$nextPageId.">Next</a>" 
           } 
          ?> 
          </b> 
         </td> 
         </tr> 
        </table> 
       </td> 
       <td height="65%" width="10%" valign="center"> 
        <!--Right panel--> 
       </td> 
      </tr> 
      <tr id="footer" bgcolor="dfdfdf"> 
       <td height="5%" colspan="3"> 
      count is : <?php echo $count; include("Footer.php"); ?> 
     <!-- do not get this part when upload on server --> 
       </td> 
      </tr> 
     </table> 
</body> 
</html> 

本页面给出了当我尝试它我的本地机器上所期望的结果。 但是,当我把它上传到我的主机服务器,我面临着以下问题:

  1. 这表明只有前3(在网页上没有滚动条)的文章中相应部分,在那里为我的本地机器上显示所有的文章用滚动条。
  2. 不包括footer.php
  3. 不显示背景色
  4. 设置我试图设置边框的表,但它不会显示任何边界上

hosted site on the server

我的本地机器我有XAMPP(Basispaket)版本1.7.4与PHP 5.3.5和服务器我有版本5.2.6(作为CGI应用程序运行)

是否有任何人有我关于为什么我面临这个问题,以及可能的解决方案是什么。

+0

很多事情都可能导致这种情况。你有没有检查你的服务器的PHP错误日志? –

回答

0

最后我想通了。 问题内容存储在数据库中,它包含一些代码和一些xml在网页上显示。 所以我只是用这两条线

<?php 
$content=htmlentities($content); 
echo "<pre><code>".$content."</code></pre>" 
?> 

它工作正常。

为我使用风格和现在工作的背景颜色。

1

标记看起来很怪异,我发现错误消息,在底部:

Failed loading D:\ioncube\ioncube_loader_win_5.2.dll 
Failed loading D:\ioncube\ioncube_loader_win_4.4.dll 

好吧,我觉得这个问题在文件中,您包括(LeftPanel.php,例如)。 为什么它包含此代码:

<!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> 
... 

当您包含此 - 标记中断。

+0

我找到问题的内容部分所显示的最后屏幕上包含一些代码<形式X:键= PivotStyle1的TargetType =控件:枢轴> \t \t \t \t \t \t \t \t \t \t \t \t \t <设置器。价值> \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t \t 因为当我删除了这部分一切正常F9 什么都可以我为它做了 – Mohit

1

footer.php问题可能与大写问题有关。 PHP文件是否有首字母大写?如果不完全正确,某些服务器将会例外。

+0

它的capatalized – Mohit