PHP 增刪改查 import!!

2022-07-23 16:39:21 字數 2320 閱讀 6066

主頁面

idinfocode

name

title

firm

orders

update

delete

<?php

//造連線物件

$fam = new mysqli("localhost","root","","zw");

//判斷是否連線

!mysqli_connect_error() or die("連線失敗");

//寫sql語句

$sql="select * from family";

//執行語句

$result = $fam->query($sql

);

//取資料

$attr = $result->fetch_all();

foreach($attr

as$v

) '";

$rname=$fam->query($sql2

);

$attn=$rname->fetch_row();

echo "

$v[0]}'>更改

$v[0]}'>刪除

"; }

?>

新增資料

新增頁面

主頁面

純php 新增處理頁面

<?php

$ids=$_post["ids"];

$infocode=$_post["infocode"];

$name=$_post["name"];

$title=$_post["gx"];

$firm=$_post["firm"];

$orders=$_post["orders"];

$fam=new mysqli("localhost","root","","zw");

!mysqli_connect_error() or die("連線失敗!");

$sql="insert into family values('','','','','','')";

$result=$fam->query($sql

);if($result

)else

修改頁面

<?php

$ids=$_get["ids"];

$fam=new mysqli("localhost","root","","zw");

!mysqli_connect_error() or die("失敗");

$sql1="select * from family where ids=";

$r=$fam->query($sql1

);$att=$r->fetch_row();

?>主頁面

純php 修改處理頁面
<?php

$ids=$_post["ids"];

$infocode=$_post["infocode"];

$name=$_post["name"];

$title=$_post["title"];

$firm=$_post["firm"];

$orders=$_post["orders"];

$fam=new mysqli("localhost","root","","zw");

!mysqli_connect_error() or die("連線失敗!");

$sql="update family set name='',title='',firm='',orders=''where ids=''";

$result=$fam->query($sql

);if($result

)else

純php 修改處理頁面
<?php

$ids=$_get["ids"];

$fam=new mysqli("localhost","root","","zw");

!mysqli_connect_error() or die("失敗");

$sql="delete from family where ids=";

$r=$fam->query($sql

);if($r

)else

php簡易增刪改查

1 新建資料庫 news,blogs 2 php連線資料庫 conn.php header content type text html charset utf 8 mysql connect localhost 3306 root admin123 or die mysql連線失敗 mysql s...

mysql增刪改查效果 mysql增刪改查

檢視所有資料庫 mysql show databases 建立乙個庫ghd並指定字符集為utp8 mysql create database ghd charset utf8 檢視mysql支援的字符集 mysql show char set 建立乙個表,並設定id為主鍵 create table ...

mysql增刪改查擴充套件 MySQL增刪改查

1 插入 insert 1 insert into 表名 values 值1 值2 例子 insert into t1 values zengsf 23 fengshao 22 2 insert into 表名 欄位1,values 值1 例子 insert into t1 name values ...