2011-11-22 226 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

相關問題