st:6033", "root", ""); mysql_select_db("guest_book"); $exec="select * from contents where id=".$_GET['id']; $exec="update contents set content='".$_POST['post_contents']."' where id=".$_POST['id']; $result=mysql_query($exec); } mysql_close(); header("location:admin_index.php"); ?>
最后就是删除功能的实现了 delete.php <? session_start(); if($_SESSION['admin']=="OK") { $conn=mysql_connect ("localhost:6033", "root", ""); mysql_select_db("guest_book"); $exec="delete from contents where id=".$_GET['id']; mysql_query($exec); mysql_close(); header("location:admin_index.php"); } ?>
///////////////////////////////////////////////////////////////////////////////////////////////////////////////// 今天用到的知识如下: 1: session_start(); $_SESSION['变量名']=$变量名 或者 某一特定值 2: <a href="#####.php?var=##">aaa</a>用这个方法来传递参数 同时用 $_GET['var']来接收传递过来的值 3: 数据修改 :$exec="update tablename 上一页 [1] [2] [3] [4] [5] [6] [7] [8] 下一页
|