就是输入关键字 得到列表这个是我现在的代码 
新手刚学PHP 网上看了很多例子 都很复杂 不胜感激<!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=utf-8" />
<title>會員管理</title>
<style>
table{ border:1px solid #CCCCCC; border-width:1 0 0 1;}
td{ border:1px solid #CCCCCC; border-width:0 1 1 0;}
a{ text-decoration:none; color:#66CCFF;}
</style>
</head>
<?php 
include("session.php");
$action=trim($_GET['action']);
if($action==del){
del();
}else if($action==up){
up();
}else if($action==member){
member();
}else{
sel();
}

function sel(){
$db=new DB_help;
$vip=$_GET["type"];
$as="vip";
$sql="select * from users where users_status!='paid'  order by users_id desc";
$count=$db->getCount("select count(*) from users where users_status!='paid'   order by users_id desc");
$val=$db->pageOn($sql,$_GET['p'],10,$count);
?>
<body>
<form action="?action=del" method="post" id="frm" name="frm">
<table cllpadding="0" cellspacing="0">
     <tr>
             <td colspan="4" style="color:#b3dd22; font-weight:bold;" align="center">
             普通會員管理</td>
        </tr>
     <tr align="center" style="font-weight:bold;">
         <td width="60">編號</td>
            <td width="250">名稱</td>           
            <td width="150">申請高級會員</td>           
            <td>編輯</td>
        </tr>
        <?php foreach($val as $v){?>
        <tr>
         <td><?php echo $v["users_id"];?></td>
            <td><?php echo $v["users_name"];?></td>
            <?php  if($vip!=$as ){?>
            <td align="center" style=" color:#FF0000;"><?php  if($v["users_vip"]=='vip' and $v["users_status"]=='payment' ){echo "V";}?></td>
            <?php }?>
            <td><a href="member.php?action=del&id=<?php echo $v["users_id"]?>&type=<?php echo $v["users_vip"];?>" onclick="return confirm('你確定要刪除嗎?')">刪除</a>
             <a href="vusers.php?id=<?php echo $v["users_id"]?>&type=<?php echo $v["users_vip"];?>">查看</a>               
               <a href="member.php?action=up&id=<?php echo $v["users_id"]?>&type=<?php echo $v["users_vip"];?>" onclick="return confirm('你確定該用戶已付款嗎?')">確認成為高級會員</a>
                              
                </td>
        </tr>
<?php }?>
        <!--<tr>
         <td colspan="3">
             <a href="adddusers.php">增加</a>                
            </td>
       </tr>-->
    </table><p><?php echo $db->paging("?type=$vip&"); ?></p>
</form><?php }?>
<?php 
function del(){
$odb=new odb;
$id=$_GET["id"];
$type=$_GET["type"];
$sql="delete from users where users_id=$id";
$odb->opera($sql,"","member.php?type=$type");
}
function up(){
$odb=new odb;
$id=$_GET["id"];
$type=$_GET["type"];
date_default_timezone_set("PRC");
$date=date("Y-m-d H:i:s");
$st="paid";
$sql="update users set users_vip_date='$date',users_status='$st',users_vip='vip' where users_id=$id";
$odb->opera($sql,"","member.php?type=$type");
}
function member(){
$odb=new odb;
$id=$_GET["id"];
$type=$_GET["type"];
date_default_timezone_set("PRC");
$date=date("Y-m-d H:i:s");
$st="paid";
$sql="update users set users_vip_date='$date',users_status='$st',users_vip='vip' where users_id=$id";

$odb->opera($sql,"已經成為高級會員","member_me.php");
}
?>
</body>
</html>

解决方案 »

  1.   

    include("session.php");这个不是应该放在最上面吗?里面是否有 "session_start();"??<!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=utf-8" />
    <title>會員管理</title>
    <style>
    table{ border:1px solid #CCCCCC; border-width:1 0 0 1;}
    td{ border:1px solid #CCCCCC; border-width:0 1 1 0;}
    a{ text-decoration:none; color:#66CCFF;}
    </style>
    </head>
    <?php 
            include("session.php");
            $action=trim($_GET['action']);
            if($action==del){
                del();
            }else if($action==up){            
                up();
            }else if($action==member){
                member();
            }else{            
                sel();
            }
            
            function sel(){            
            $db=new DB_help;
            $vip=$_GET["type"];
            $as="vip";
    if($action=='search')
    {
    $user_name=$_post['user_name']
    $sql="select * from users where users_status!='paid' and users_name='$user_name' order by users_id desc";
    }else{
    $sql="select * from users where users_status!='paid'  order by users_id desc";
    }

            $count=$db->getCount("select count(*) from users where users_status!='paid'   order by users_id desc");
            $val=$db->pageOn($sql,$_GET['p'],10,$count);
    ?>
    <body>
        <table width="600" border="0" cellspacing="0" cellpadding="0">
    <form action="?action=search" method="post" id="frm_search" name="frm_search">
         <tr>
         <td>会员搜索</td>
        </tr>
         <tr>
         <td><label for="user_name"></label>
        <input type="text" name="user_name" id="user_name" /> <input type="submit" name="button" id="button" value="提交" /></td>
        </tr>
    </form>
        </table>
        <table cllpadding="0" cellspacing="0">
    <form action="?action=del" method="post" id="frm" name="frm">
            <tr>
                 <td colspan="4" style="color:#b3dd22; font-weight:bold;" align="center">
                 普通會員管理</td>
            </tr>
            <tr align="center" style="font-weight:bold;">
                <td width="60">編號</td>
                <td width="250">名稱</td>           
                <td width="150">申請高級會員</td>           
                <td>編輯</td>
            </tr>
            <?php foreach($val as $v){?>
            <tr>
                <td><?php echo $v["users_id"];?></td>
                <td><?php echo $v["users_name"];?></td>
                <?php  if($vip!=$as ){?>
                <td align="center" style=" color:#FF0000;"><?php  if($v["users_vip"]=='vip' and $v["users_status"]=='payment' ){echo "V";}?></td>
                <?php }?>
                <td><a href="member.php?action=del&id=<?php echo $v["users_id"]?>&type=<?php echo $v["users_vip"];?>" onclick="return confirm('你確定要刪除嗎?')">刪除</a>
                    <a href="vusers.php?id=<?php echo $v["users_id"]?>&type=<?php echo $v["users_vip"];?>">查看</a>               
                   <a href="member.php?action=up&id=<?php echo $v["users_id"]?>&type=<?php echo $v["users_vip"];?>" onclick="return confirm('你確定該用戶已付款嗎?')">確認成為高級會員</a>
                                  
                </td>
            </tr>
            <?php }?>
            <!--<tr>
                <td colspan="3">
                    <a href="adddusers.php">增加</a>                
                </td>
           </tr>-->
    </form>
        </table><p><?php echo $db->paging("?type=$vip&"); ?></p>
    <?php }?>
    <?php 
        function del(){
            $odb=new odb;
            $id=$_GET["id"];
            $type=$_GET["type"];
            $sql="delete from users where users_id=$id";
            $odb->opera($sql,"","member.php?type=$type");
        }
        function up(){        
            $odb=new odb;
            $id=$_GET["id"];
            $type=$_GET["type"];
            date_default_timezone_set("PRC");
            $date=date("Y-m-d H:i:s");
            $st="paid";
            $sql="update users set users_vip_date='$date',users_status='$st',users_vip='vip' where users_id=$id";        
            $odb->opera($sql,"","member.php?type=$type");
        }
        function member(){
            $odb=new odb;
            $id=$_GET["id"];
            $type=$_GET["type"];
            date_default_timezone_set("PRC");
            $date=date("Y-m-d H:i:s");
            $st="paid";
            $sql="update users set users_vip_date='$date',users_status='$st',users_vip='vip' where users_id=$id";
            
            $odb->opera($sql,"已經成為高級會員","member_me.php");
        }
    ?>
    </body>
    </html>
      

  2.   

    没看你那一大段代码,你可以得到输入的值吗,可以的话就select数据表,对比一下就行了。当然如果是模糊查询,就加上匹配符号