大神们,我做毕业设计这里要设计点击新闻标题后跳转到详细页面,我数据库表里有ID,标题,内容,时间。我使用DW做的
这是新闻总览
这是详细内容

解决方案 »

  1.   

    <a href=view.phph?id={Recordset1.id}>{Recordset1.title}</a>
      

  2.   

    图一标题页
    <table width="586" height="37" border="0">
                   <tr>
                     <td width="416"><a href="xinwenneirong.php"><?php echo $row_Recordset1['title']; ?></a></td>
                     <td width="160"><?php echo $row_Recordset1['date']; ?></td>
                   </tr>
                 </table>图二内容
    <table width="600" height="400" border="0">
           <tr>
             <td height="24" align="center" valign="middle"><?php echo $row_Recordset1['title']; ?></td>
           </tr>
           <tr>
             <td height="360" valign="top"><?php echo $row_Recordset1['text']; ?></td>
           </tr>
         </table>连接数据库
    <?php require_once('Connections/qiyewangzhan.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);  switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }$currentPage = $_SERVER["PHP_SELF"];$maxRows_Recordset1 = 8;
    $pageNum_Recordset1 = 0;
    if (isset($_GET['pageNum_Recordset1'])) {
      $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
    }
    $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;mysql_select_db($database_qiyewangzhan, $qiyewangzhan);
    $query_Recordset1 = "SELECT * FROM news ORDER BY id DESC";
    $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
    $Recordset1 = mysql_query($query_limit_Recordset1, $qiyewangzhan) or die(mysql_error());
    $row_Recordset1 = mysql_fetch_assoc($Recordset1);if (isset($_GET['totalRows_Recordset1'])) {
      $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
    } else {
      $all_Recordset1 = mysql_query($query_Recordset1);
      $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
    }
    $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;$colname_Recordset2 = "-1";
    if (isset($_GET['id'])) {
      $colname_Recordset2 = $_GET['id'];
    }
    mysql_select_db($database_qiyewangzhan, $qiyewangzhan);
    $query_Recordset2 = sprintf("SELECT * FROM news WHERE id = %s ORDER BY id DESC", GetSQLValueString($colname_Recordset2, "int"));
    $Recordset2 = mysql_query($query_Recordset2, $qiyewangzhan) or die(mysql_error());
    $row_Recordset2 = mysql_fetch_assoc($Recordset2);
    $totalRows_Recordset2 = mysql_num_rows($Recordset2);$queryString_Recordset1 = "";
    if (!empty($_SERVER['QUERY_STRING'])) {
      $params = explode("&", $_SERVER['QUERY_STRING']);
      $newParams = array();
      foreach ($params as $param) {
        if (stristr($param, "pageNum_Recordset1") == false && 
            stristr($param, "totalRows_Recordset1") == false) {
          array_push($newParams, $param);
        }
      }
      if (count($newParams) != 0) {
        $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
      }
    }
    $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);?>
      

  3.   

    <a href="xinwenneirong.php?在这里传递文章id"><?php echo $row_Recordset1['title']; ?></a>
      

  4.   

    如何获取传递后的参数呢。 是不是使用$Get_Recordset1['id'];放到和传递参数一样的位置<td height="24" align="center" valign="middle"><?php echo $row_Recordset1['title']; ?></td>
           </tr>
           <tr>
             <td height="360" valign="top">
     <?php echo $row_Recordset1['text']; ?></td>
           </tr>
      

  5.   

    首先在页面上面加上GET参数 直接跳转到处理方法里面去,用GET方式获取到文章ID 后,把数据取出来 然后用include把HTML 页面引入进来 然后把对应的变量写到页面上就可以了
      

  6.   

    如何获取传递后的参数呢。 是不是使用$Get_Recordset1['id'];放到和传递参数一样的位置<td height="24" align="center" valign="middle"><?php echo $row_Recordset1['title']; ?></td>
           </tr>
           <tr>
             <td height="360" valign="top">
     <?php echo $row_Recordset1['text']; ?></td>
           </tr>
    如何获取URL传递的参数都不知道?说明你基础知识还没学好,建议先过一遍基础知识。磨刀不误砍柴功呀。