0

嗨,我有一个已启动的网站,但我的新闻文章没有显示,我正在使用 url 变量来确定要加载到动态 php 页面上的文章。

我的网站是 www.coverforce.com.au,问题链接是显示在右下角索引页面上的新闻文章。

我的查询代码如下:

 $totalRows_variablearticles = "-1";
if (isset($_GET['id'])) {
  $totalRows_variablearticles = $_GET['id']; 
  }
mysql_select_db($database_newsDBconnection, $newsDBconnection);
$query_variablearticles = sprintf("SELECT * FROM NewsArticles, NewsArticleCategories, NewsArticlePhotos, NewsPhotos, NewsCategories WHERE NewsArticles.id = %s AND NewsArticles.id = NewsArticleCategories.newsArticleID AND NewsArticles.id = NewsArticlePhotos.newsArticleID AND NewsArticlePhotos.newsPhotoID = NewsPhotos.id AND NewsArticleCategories.newsCategoryID = NewsCategories.id", GetSQLValueString($totalRows_variablearticles, "int"));
$variablearticles = mysql_query($query_variablearticles, $newsDBconnection) or die(mysql_error());
$row_variablearticles = mysql_fetch_assoc($variablearticles);
$totalRows_variablearticles = mysql_num_rows($variablearticles);

我的 htaccess 代码是

Options +FollowSymlinks
RewriteEngine On
RewriteRule ^/?test\.html$ test.php [L]
RewriteRule ^/?index\.html$ index.php [L]
RewriteRule insurance-news/news/(.*)/(.*)/$ insurance-news/news.php?$1=$2

rewritecond %{http_host} ^coverforce.com.au [nc]
rewriterule ^(.*)$ http://www.coverforce.com.au/$1 [r=301,nc] 

这是我用来将内容加载到页面上的代码

<h1><?php echo $row_variablearticles['headline']; ?></h1>
    <p>Posted:<?php echo $row_variablearticles['publishDate']=substr($row_variablearticles['publishDate'],0,-8); ?></p>
    <p><br /> 
      <?php echo $row_variablearticles['text']; ?></p>

你能提供的任何帮助都会很棒——如果我不尽快修好,我的老板会砍掉我的头,哈哈

4

1 回答 1

0

在 .htaccess 中,您有:

RewriteRule insurance-news/news/(.*)/(.*)/$ insurance-news/news.php?$1=$2

您的代码正在寻找“id”的获取,因此该行肯定应该是

RewriteRule insurance-news/news/(.*)/(.*)/$ insurance-news/news.php?id=$2

做一个 print_r($_GET); (或者如果站点是活动的,则转储到日志文件)并检查它显示的内容。

于 2012-05-24T03:36:28.383 回答