1增 insert.php html head /head body form action="doinsert.php" method="POST" p ID:br/ input type="text" name="id" size="6" maxlength="6" / /p p 给自己起一个名号:br/ input type="text" name="name" size="10" maxlength="10" / /p p 给自己设一个
1增
insert.php
doinsert.php
$linkID=@mysql_connect("localhost","root","123456");
if(!$linkID){
echo "没连接上";
}
$ss=@mysql_select_db("bean");
if(!$ss){
echo "没找到数据库";
}
$id = $_POST['id'];
$name = $_POST['name'];
$password = $_POST['password'];
$email = $_POST['email'];
$query = "INSERT INTO member3 (id,name,password,email) values(
'$id','$name','$password','$email')";
//$query = "insert into member3 set
// id='$id',name='$name',password='$password',email='$email'";
$result = mysql_query($query);
if($result) echo "
member successfuly insert!
";else echo "
There was a problem inserting the member!
";mysql_close();
include "insert.php" //返回并继续插入
?>
2查询并且修改
form.php
modify.php
$linkID=@mysql_connect("localhost","root","123456");
$ss=@mysql_select_db("bean");
$rowID = $_POST['rowID'];
$query="select id ,name,password,email from member3 where id='$rowID'";
$result=mysql_query($query);
if(!$result){
echo "没执行成功";
}
//echo "$result";
list($id,$name,$password,$email)=mysql_fetch_row($result);
//echo "$id";
//echo "$name";
//echo "$password";
//echo "$email";
mysql_close();
include "modifyform.php";
?>
modifyform.php
update.php
$linkID=@mysql_connect("localhost","root","123456");
$db=@mysql_select_db("bean");
$rowID=$_POST['rowID'];
$id=$_POST['id'];
$name=$_POST['name'];
$password=$_POST['password'];
$email=$_POST['email'];
//echo $rowID;
$query=" UPDATE member3 SET id='$id',name='$name',password='$password',email='$email'where id='$rowID' ";
//echo $query;
$result=mysql_query($query);
if($result) echo "
member successfuly update!
";else echo "
There was a problem updating the member!
";mysql_close();
?>
3删除 多选删除
deleteform.php 复选框
deleteform1.php 多选下拉列表
delete.php 遍历数组删除
$linkID=@mysql_connect("localhost","root","123456");
$db=@mysql_select_db("bean");
//echo $_POST['kk'];
//echo array('1','2','3');
foreach($_POST['kk'] as $pp)//遍历数组,给每个赋值
{
echo $pp;
$rowID=$pp;
$query="delete from member3 where id='$rowID'";//查询语句
$result=mysql_query($query);//放到数据库执行
if(!mysql_affected_rows()==0)
echo "
选择的项".$rowID."已经成功的被删除!
" ;if(mysql_affected_rows()==0){
echo "
没有找到记录!
" ;}
}
?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)