首页 > phper

数据库添加、修改、删除基础操作代码(1/4)

  require_once('common.php');
  $action = $_get['action'];
?>

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.phprm.com/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>人才列表</title>
<link href="style.css教程" type="text/css" rel="stylesheet" />
</head>
<body> 
 <div id="wrap">
 <div id="main">
 <?php
      if($action=='add'){
 ?>
    <form action="?action=save" method="post" name="form1">
  <table width="300" border="0" cellspacing="0" cellpadding="0"  class="post">
          <tr>
            <td colspan="2">添加人员</td></tr>
          <tr><td width="78">登陆账号</td>
            <td width="220"><input name="login" type="text" id="login" /></td>
          </tr>
          <tr>
            <td>登陆密码</td>
            <td><input name="pws" type="text" id="pws" /></td>
          </tr>
          <tr>
            <td>问题</td>
            <td><input name="question" type="text" id="question" /></td>
          </tr>
           <tr>
            <td>答案</td>
            <td><input name="answer" type="text" id="answer" /></td>
          </tr>
            <tr>
              <td colspan="2"><input name="button" type="submit" id="button" value=" 添加 " /></td>
            </tr>
             
      </table>
    </form>
 <?php  
      }
      elseif($action=='save'){
    $login = isset($_post['login']) ? $_post['login'] : '';
    $pws = isset($_post['pws']) ? $_post['pws'] : '';
    $question = isset($_post['question']) ? $_post['question'] : '';
    $answer = isset($_post['answer']) ? $_post['answer'] : '';
    $sql = "insert into person (login,pws,question,answer)
    values('$login','$pws','$question','$answer')";
    $db->query($sql);
    forward('发布成功','href','personlist.php');
          }

阅读全文

php通用分页类代码

 

class dividepage{//分页类
 private $total;//要显示的总记录数
 private $url;//请求的url地址
 private $displaypg;//每页显示的记录数,默认为每页显示10条记录
 private $page;//当前页码
 private $lastpg;//总页数,即最后一页的页码
 private $prepg;//前一页
 private $nextpg;//后一页
 private $firstcount;//记录条数开始的序号从0开始
 private $startd;//记录条数开始的记录号.
 private $stopd;//记录条数结束的记录号.

阅读全文

php留言板程序(适合php初学者)(1/4)

<!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=gbk" />
<title>所有留言</title>
<link rel="stylesheet" type="text/css教程" href="style.css" media="all" />
</head>

阅读全文

php数字分页类代码(仿百度分页效果)

$conn=mysql教程_connect("localhost","root","");
$db=mysql_select_db("gan");
 mysql_query("set names 'gbk'");
?>
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.phprm.com/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

阅读全文