php mysql增刪改除頁面之編輯頁面

2021-09-23 08:17:22 字數 1247 閱讀 2222

編輯頁面

<?php 

//判斷是否接受到id

if(empty($_get['id']))

$id=$_get['id'];

$conn =mysqli_connect('localhost','root','123456','yitu');

if (!$conn)

$query = mysqli_query($conn, "select * from users where id=;");

if (!$query)

//查詢到資料後,將資料的關聯陣列匯出來

$user=mysqli_fetch_array($query);

function edit()

if(empty($_post['number']))

if(!(isset($_post['vip'])&&$_post['vip']!=='-1'))

$user['name']=$_post['name'];

$user['number']=$_post['number'];

$user['vip']=$_post['vip'];

$conn =mysqli_connect('localhost','root','123456','yitu');

if (!$conn)

$query = mysqli_query($conn, "update users set name='',number='',vip='' where id=");

if (!$query)

header('location:user.php');

}if($_server['request_method']=='post')

?>

<?php include'template.php'?>

<?php if(isset($error_message)):?>

<?php echo $error_message;?>

<?php endif?>

編輯使用者張三

PHP MySql增刪改查

mysql connect 連線資料庫 mysql select db選擇資料庫 mysql fetch assoc 獲取結果集 mysql query 執行sql語句 例項如下 con mysql connect localhost root root 連線資料庫 mysql select db ...

PHP MySql增刪改查

mysql connect 連線資料庫 mysql select db選擇資料庫 mysql fetch assoc 獲取結果集 mysql query 執行sql語句 例項如下 con mysql connect localhost root root 連線資料庫 mysql select db ...

PHP Mysql 實現資料庫增刪改查

php和mysql可以對資料庫進行簡單的增刪改查,本文介紹了新聞列表的後台管理。建立乙個新聞列表的資料庫 td 增加新聞 id標題關鍵字 作者發布時間 內容操作 1.匯入配置檔案 require dbconfig.php 2.連線mysql 選擇資料庫 mysql select db dbname,...