熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> PHP編程 >> 正文

PHP網絡開發詳解:文章管理頁面的實現[1]

2022-06-13   來源: PHP編程 
    ——此文章摘自《完全手冊PHP網絡開發詳解》定價 特價 詳細>>http://tracklinktechcn/?m_id=dangdang&a_id=A&l=&l_type= width= height= border= nosave>

    文章管理頁面主要實現對文章的修改刪除和審核操作這裡通過JavaScript代碼實現對刪除和審核的確認其代碼如下所示
    <a onClick=javascript:return confirm(確認要刪除嗎?) href=admin_delete php?article_id=<?php echo $row_rs_articles[article_id]; ?>>刪除</a>

    首先需要顯示所有文章的列表其代碼如下所示
    <?php require_once(Connections/connphp); ?>
    <?php
    $currentPage = $_SERVER[PHP_SELF];
    $maxRows_rs_articles = ;
    $pageNum_rs_articles = ;
    if (isset($_GET[pageNum_rs_articles]))
    {
      $pageNum_rs_articles = $_GET[pageNum_rs_articles];
    }
    $startRow_rs_articles = $pageNum_rs_articles * $maxRows_rs_articles;
    mysql_select_db($database_conn $conn);
    $query_rs_articles = SELECT * FROM articles ORDER BY article_id DESC;
    $query_limit_rs_articles = sprintf(%s LIMIT %d %d $query_rs_articles
    $startRow_rs_articles $maxRows_rs_articles);
    $rs_articles = mysql_query($query_limit_rs_articles $conn) or die(mysql_ error());
    $row_rs_articles = mysql_fetch_assoc($rs_articles);
    if (isset($_GET[totalRows_rs_articles]))
    {
      $totalRows_rs_articles = $_GET[totalRows_rs_articles];
    }
    else
    {
      $all_rs_articles = mysql_query($query_rs_articles);
      $totalRows_rs_articles = mysql_num_rows($all_rs_articles);
    }
    $totalPages_rs_articles = ceil($totalRows_rs_articles/$maxRows_rs_articles);
    $queryString_rs_articles = ;
    if (!empty($_SERVER[QUERY_STRING]))
    {
      $params = explode(& $_SERVER[QUERY_STRING]);
      $newParams = array();
    foreach ($params as $param)
    {
        if (stristr($param pageNum_rs_articles) == false &&
            stristr($param totalRows_rs_articles) == false)
        {
          array_push($newParams $param);
        }
      }
      if (count($newParams) != ) {
        $queryString_rs_articles = & htmlentities(implode(& $newParams));
      }
    }
    $queryString_rs_articles = sprintf(&totalRows_rs_articles=%d%s $totalRows_
    rs_articles $queryString_rs_articles);
    ?>
    <!DOCTYPE HTML PUBLIC //WC//DTD HTML Transitional//EN http://www worg/TR/html/loosedtd>

right>[]  [http://developcsaicn/web/htm>]  [http://developcsaicn/web/htm>]  [http://developcsaicn/web/htm>]  [http://developcsaicn/web/htm>]  


From:http://tw.wingwit.com/Article/program/PHP/201311/21384.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.