看你用什么数据库啰
不过不管用什么数据库,都要经过SQL查询语言

解决方案 »

  1.   

    添加 insert 
    修改 update
    删除 delete去找一本PHP的书吧,肯定有的!!!!
      

  2.   

    php手册中讲解了多种数据库操作函数,结合sql语句完成对数据库的各种操作。
      

  3.   

    建议你用phplib,因为里面大多对象都封装了,所以你不必知道里面的具体环节,只要知道,函数的调用就行了。可以马上建立连接数据库,快速的对数据库进行操作》,凡是都要试,呵呵试试吧,
    用惯了就好了
      

  4.   

    $insert=inert into 表名 (变量1,变量2) values ('值1','值2');
    $delete=delete from  表名 where 删除条件;
    $update= update 表名 set 变量=新值 where 条件;
      

  5.   

    $con =mysql_connect('localhost','用户名','密码') or die("连接失败");
    mysql_select_db("数据库名",$con) or die("数据库连接失败");
    $sql="insert or delete update 的sql 语句";
    $res = mysql_query($sql,$con);//执行sql语句
    $err = mysql_error();
    if($err)
    echo "发生错误!\n";
    else
    echo "添加成功!\n";
      

  6.   

    谢谢你的解答,我主要是想实现下面代码的查询、修改、删除、添加功能,能否详细点告诉我啊谢谢!
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>无标题文档</title>
    </head><body>
    <table width="100%" border="0" cellspacing="2" cellpadding="0">
      <tr> 
        <td height="69"> 
          <div align="center"><strong><img src="images/title.gif" width="520" height="38"></strong></div></td>
      </tr>
      <tr>
        <td height="80" valign="top"> 
          <form name="form1" method="post" action="">
            <table width = "100%" border ="1" align="center" cellpadding="0" cellspacing="0" bordercolorlight='#000000' bordercolordark='#EFF9FC' ">
              <tr> 
                <td height="30" colspan="9" align="center"> <div align="left"><font color="#FF0000" size="2">请选择使用科室&nbsp; 
                    <select name="select">
                      <option>电脑室</option>
                      <option>教务处</option>
                    </select>
                    </font></div></td>
              </tr>
              <tr> 
                <td width="37" height="26" align="center"><font color="#FF0000" size="2">序号</font></td>
                <td width="74" align ="center"><font color="#FF0000" size="2">科室</font></td>
                <td width="69" align ="center"><font color="#FF0000" size="2">名称</font></td>
                <td width="82" align ="center"><font color="#FF0000" size="2">规格</font></td>
                <td width="109" align ="center"><font color="#FF0000" size="2">数量</font></td>
                <td width="124" align ="center"><font color="#FF0000" size="2">单价(元)</font></td>
                <td width="81" align ="center"><font color="#FF0000" size="2">总价(元)</font></td>
                <td width="65" align ="center"><font color="#FF0000" size="2">备注</font></td>
                <td width="104" align ="center"><font color="#FF0000" size="2">操作</font></td>
              </tr>
            </table>
          </form></td>
      </tr>
      <tr> 
        <td><meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 
          <?
    $connect=@mysql_connect('localhost','root','');
    $query="select * from dengji order by ID desc";
    $result=mysql_db_query("oa",$query,$connect);
    $total=@mysql_num_rows($result); //结果的记录数
    $r_row=@mysql_affected_rows($result);//获得最近操作的记录
    $page_max_num=10;//每页显示的条目数
    $page_num=ceil($total/$page_max_num);//总页面数if($total > 0)
    {if(!$start_num)
     {$start_num=1;
    }
    }
    $begin = ($start_num-1)* $page_max_num;
    $end =$start_num*$page_max_num;
    for($i=$begin;$i<$end;$i++)  //取出结果$result中的全部结果
    {
    @mysql_data_seek($result,$i); //将当前记录指针指向$result中的第$i条记录
    $data=@mysql_fetch_array($result);
    if(!empty($data))//是否有数据
    {
    ?>
          <table border ="0" width = "100%" cellpadding="2" cellspacing="0" style="border-collapse: collapse" bordercolor="#CCCCCC">
            <tr bgcolor="eeeeee" > 
              <td width = "37" align="center"><font size="2"><? echo  $data[id]; ?> 
                </font></td>
              <td width= "75" align ="center"><font size="2"><? echo $data[data0]; ?></font></td>
              <td width= "64" align ="center"> <font size="2"> 
                <?   echo "<a href = 'detail.php ?title=".$data[data1]."'>$data[data1] </a>";?>
                </font></td>
              <td width= "81" align ="center"><font size="2"><? echo $data[data2]; ?></font></td>
              <td width= "106" align ="center"><font size="2"><? echo $data[data3]; ?></font></td>
              <td width= "124" align ="center"><font size="2"><? echo $data[data4]; ?></font></td>
              <td width= "81" align ="center"> <font size="2"><? echo  $data[data5]; ?> 
                </font></td>
              <td width= "63" align ="center"> <font size="2"><? echo $data[content]; ?> 
                </font></td>
              <td width= "98" align ="center"><font size="2"> 添加|修改|<a href="./index.php?op=delmsg?id=%2713%27">删除</a></font></td>
            </tr>
          </table>
          <br> <font size="2"> 
          <?
    }
    }
    ?>
          <?php
    //分页显示
     if($start_num<=1)
     {
      echo "";
     }
     else 
     {
     echo "<a href = 'b.php ?start_num=1&username=".$username."'>首页</a> ";
     
    }
     echo "|首页";
     
     if($start_num<=1)
     { echo "|上页";
    }
    else 
    {
     echo "<a href = 'b.php?start_num=".($start_num-1)."&username=".$username."'>|上页 </a> ";
    }if($start_num>=$page_num)
    {
        echo "|下页";
    }
     else
     {
      echo "<a href = 'b.php?start_num=".($start_num+1)."&username=".$username."'>|下页 </a> ";
     
     }
     if ($start_num>= $page_num)
     {
      echo "|尾页";
     }
     else 
     {
      echo "<a href = 'b.php?start_num=".$page_num."&username=".$username."'>|尾页</a> ";
     }
      echo "[ ".$start_num."页/".$page_num."页 ]"  ;
     echo "共 [".$total."]条记录";
      echo " <a href = 'add.php?username=".$username."'></a> <br>";  mysql_close($connect);    
    ?>
          </font></td>
      </tr>
      <tr> 
        <td>&nbsp;</td>
      </tr>
    </table>
    </body>
    </html>