<?php require_once('E:\phpDev\ch10\connections\conn_news.php'); ?>
<?php
mysql_select_db($database_conn_news, $conn_news);
$query_newsType1 = "SELECT * FROM newstable ORDER BY newsTime DESC";
$newsType1 = mysql_query($query_newsType1, $conn_news) or die(mysql_error());
$row_newsType1 = mysql_fetch_assoc($newsType1);
$totalRows_newsType1 = mysql_num_rows($newsType1);$MM_paramName = ""; // *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
// create the list of parameters which should not be maintained
$MM_removeList = "&index=";
if ($MM_paramName != "") $MM_removeList .= "&".strtolower($MM_paramName)."=";
$MM_keepURL="";
$MM_keepForm="";
$MM_keepBoth="";
$MM_keepNone="";
// add the URL parameters to the MM_keepURL string
reset ($_GET);
while (list ($key, $val) = each ($_GET)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepURL .= "&".$key."=".urlencode($val);
}
}
// add the URL parameters to the MM_keepURL string
if(isset($HTTP_POST_VARS)){
reset ($HTTP_POST_VARS);
while (list ($key, $val) = each ($HTTP_POST_VARS)) {
$nextItem = "&".strtolower($key)."=";
if (!stristr($MM_removeList, $nextItem)) {
$MM_keepForm .= "&".$key."=".urlencode($val);
}
}
}
// create the Form + URL string and remove the intial '&' from each of the strings
$MM_keepBoth = $MM_keepURL."&".$MM_keepForm;
if (strlen($MM_keepBoth) > 0) $MM_keepBoth = substr($MM_keepBoth, 1);
if (strlen($MM_keepURL) > 0)  $MM_keepURL = substr($MM_keepURL, 1);
if (strlen($MM_keepForm) > 0) $MM_keepForm = substr($MM_keepForm, 1);mysql_select_db($database_conn_news, $conn_news);
$query_newsType1 = "SELECT * FROM newstable WHERE newsType = 1";
mysql_query("SET NAMES 'GB2312'");
$newsType1 = mysql_query($query_newsType1, $conn_news) or die(mysql_error());
$row_newsType1 = mysql_fetch_assoc($newsType1);
$totalRows_newsType1 = mysql_num_rows($newsType1);
?><!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>所有社会新闻</title>
<style type="text/css">
<!--
.STYLE1 { font-family: "隶书";
font-size: 24px;
color: #006633;
}
a:link {
color: #990000;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #990000;
}
a:hover {
text-decoration: none;
color: #999900;
}
a:active {
text-decoration: none;
color: #990000;
}
-->
</style>
</head><body>
<table width="100%" border="0">
  <tr>
    <td colspan="2" align="center" valign="middle"><span class="STYLE1">公司新闻</span></td>
  </tr>
  <?php do { ?>
    <tr>
      <td colspan="2" bgcolor="#f4f4f4">&nbsp;</td>
    </tr>
    <tr>
      <td align="center"></td>
      <td align="right"></td>
    </tr>
    <tr>
      <td align="center"><a href="SNewsDetail.php?<?php echo $MM_keepURL.(($MM_keepURL!="")?"&":"")."newsID=".$row_newsType1['newsID'] ?>"><?php echo $row_newsType1['newsTitle']; ?></a></td>
      <td align="right"><?php echo $row_newsType1['newsTime']; ?></td>
    </tr>
    <?php } while ($row_newsType1 = mysql_fetch_assoc($newsType1)); ?>
</table>
<p><a href="index.php">[返回首页]</a></p>
</body>
</html>
<?php
mysql_free_result($newsType1);
?>
初学PHP,从第9行:
$MM_paramName = "";
开始就看不明白了,请高手帮帮忙,谢谢!

解决方案 »

  1.   

    找自己的同事问一下吧,会点PHP的就行。
      

  2.   

    基本的语法我会,这一段代码拆开来我每一句都明白,但是和在一起我就不懂了。
    $MM_removeList = "&index="; 
    if ($MM_paramName != "") $MM_removeList .= "&".strtolower($MM_paramName)."="; 
    $MM_keepURL=""; 
    $MM_keepForm=""; 
    $MM_keepBoth=""; 
    $MM_keepNone=""; 
    我弄不清楚这几个变量时做什么的,请高手给予指点!