你引用了不存在的对象
对象$mydb没有创建或创建失败

解决方案 »

  1.   

    require_once ("includes/db_conn.inc");
    在网页上引用了,对象应该已经建立了啊!!
      

  2.   

    db_conn.inc,这里面已经建立了对象$mydb。。
      

  3.   

    下面是我的部分代码,帮忙看看
    <?php
    require_once ("includes/db_conn.inc");
    session_start();
    $username=$_SESSION['username'];if(isset($_GET['action'])) $action=$_GET['action'];
    else $action="";<html>
    <head>
    <title>管理员管理</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link href="Admin_Style.css" rel="stylesheet" type="text/css">
    </head>
    <body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0">
    <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
      <tr class="topbg"> 
        <td height="22" colspan="2" align="center"><strong>管 理 员 管 理</strong></td>
      </tr>
      <tr class="tdbg"> 
        <td width="70" height="30"><strong>管理导航:</strong></td>
        <td height="30"><a href="admin_admin.php">管理员管理首页</a>&nbsp;|&nbsp;<a href="admin_admin.php?action=add">新增管理员</a></td>
      </tr>
    </table><?php 
    switch($action){
        case "add":
                addadmin();
                break;
    case "modify":
                modify();
                break;
    case "saveadd":
                saveadd();
                break;
    case "savemodify":
                savemodify();
                break;
    case "del":
                deladmin();
                break;
    default:
                main();
    break;
    }
    ?>
    <?php 
    function main()

      $sql="select * from manager order by id";
      $result = $mydb->simpleQuery($sql);
      $iCount = $mydb->numRows($result);
      $row = $mydb->fetchRow($result,DB_FETCHMODE_ASSOC);
    ?>
    <br>
    <table width='100%' border="0" cellpadding="0" cellspacing="0">
      <tr>
      <form name="myform" method="Post" action="admin_admin.php" onsubmit="return confirm('确定要删除选中的管理员吗?');">
         <td>
    <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="border">
      <tr align="center" class="title">
        <td  width="30"><strong>选中</strong></td>
        <td  width="30" height="22"><strong> 序号</strong></td>
        <td height="22"><strong> 用 户 名</strong></td>
        <td  width="100" height="22"><strong> 权 限</strong></td>
        <td  width="100" height="22"><strong> 操 作</strong></td>
      </tr>
      <?php while (is_array($row)){?>
      <tr align="center" class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'"> 
        <td width="30"><input name="ID" type="checkbox" id="ID" value="<?php echo $row['id'];?>" <?php if($row['username']==$username) echo "disabled";?> onclick="unselectall()"></td>
        <td width="30"><?php echo $row['id'];?></td>
        <td><?php
       if($row['username']==$username)
     echo "<font color=red><b>".$username."</b></font>";
    else
     echo $row['username'];
    ?></td>
        <td width="100">
    <?php
    if($row['level']==1) echo "超级用户";
        else echo "普通用户"; 
    ?> </td>
        <td width="100">
                  <?php
    echo "<a href='admin_admin.php?action=modify&ID=".$row['id']."'>修改</a>&nbsp;&nbsp;";
    if ($iCount>1 && $row['username']!=$username)
    echo "<a href='admin_admin.php?action=del&ID=".$row['id']."' onClick=\"return confirm('确定要删除此管理员吗?');\">删除</a>";
    else
    echo "&nbsp;&nbsp;&nbsp;&nbsp;";
    ?>
        </td>
      </tr>
      <?php
      $row = $mydb->fetchRow($result,DB_FETCHMODE_ASSOC);
      }
      if ($iCount>0) $mydb->freeResult($result);
      ?>
    </table>  
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="200" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
                  选中本页显示的所有管理员</td>
                <td><input name="action" type="hidden" id="action" value="del">
                  <input name="Submit" type="submit" id="Submit" value="删除选中的管理员"></td>
      </tr>
    </table>
    </td>
    </form></tr></table>
    <?php
    }