精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>编程开发>>● PHP>>功能代码>>留言板>>转载一个php操作mysql的留言版的例子3

主题:转载一个php操作mysql的留言版的例子3
发信人: zawenhui()
整理人: jackyz(2000-08-10 12:21:18), 站内信件
//admin
<?
include ("./connect.inc.php3");
include("$header");
include ("./theme.inc.php3");
{

$result1 = mysql_query("select Count(*) as total from $userstable")
or die(mysql_error());
$row=mysql_fetch_Array($result1);
$total=$row[total];
}

if ((!isset($show)) and (!isset($delete))) $show=0;

if (!isset($delete)){
if ($show < $total){
$query = "select * from $userstable order by id desc limit $show, $lim
it";
$result = mysql_query($query);
$number = mysql_num_rows($result);
}

elseif ($show == "all"){
$query = "select * from $userstable order by id desc";
$result = mysql_query($query);
$number = mysql_num_rows($result);
}

$i = 0;

if ($number > 0) {

        while ($i < $number){

$row = mysql_fetch_array($result);
$name = stripslashes($row[name]);
$email = $row[email];
$body = stripslashes(nl2br($row[body]));
$id = $row[id];


print "<table border=0 cellspacing=0 cellpadding=3 width=\"800\">";
print "<tr><td width=100% align=\"left\">ID: $id<br>$name1: <a hre
f=\"mailto:$email\">$name
</td></tr>";
print "<tr><td width=100% align=\"left\">$comment:<br>$body</td></tr>"
;
print "<tr><td><a href=\"$PHP_SELF?delete=$id\">删除 Entry $id</td
></tr>";
print "<br><br>";
                $i++;
print "</table>";
}
include ("./pages.inc.php3");
}
}
elseif ((isset($delete)) and (!isset($show))){
$delquery = "select * from $userstable";
$delresult = mysql_query($delquery);
mysql_query("delete from $userstable where (id = '$delete')");
print "<html><head><meta http-equiv=\"Refresh\"content=\"5; URL=$PHP_S
ELF\"></head><body>";
print "<center>Entry $delete 已被删除<br><br>请等候五秒钟,即可自动回到
管理页面</center>";
}
include("$footer");
?>
《待续》

--
████████████████████████████████
█  ╭──────────────────────────╮  █
█  │最憎人对住我讲英文,最憎人讲日文,最憎人偏偏唔识讲广│  █
█  │州话,使乜望住我啊,就系讲紧你。                    │  █
█  │~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~            │  █
█  │ oicq:9880798                                       │  █

※ 来源:.月光软件站 http://www.moon-soft.com.[FROM: 202.104.73.145]

[关闭][返回]