


Basic operation code for adding, modifying and deleting database (1/4)_PHP tutorial
Basic operation codes for database addition, modification, and deletion This is a tutorial that is more suitable for PHP beginners. We use a simple example to add, modify, and delete the database, so that you can know the key points of PHP mysql database operations in a more systematic way.
Database tutorial to add, modify and delete basic operation codes
This is a tutorial that is more suitable for beginners to learn PHP tutorials. We use a simple example to add, modify, and delete the database, so that you can know the key points of database operations in the PHP mysql tutorial in a more systematic way.
*/
require_once('common.php');
$action = $_get['action'];
?>
1 2 3 4
人才列表
if($action=='add'){
?>
}
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');
}elseif($action=='del'){
$person_id=$_get['person_id'];
$page=$_get['page'];
$sql="delete from person where person_id='$person_id'";
$db->query($sql);
forward('删除成功','href','personlist.php?page='.$page);
}
elseif($action=='editsave'){
$person_id = isset($_post['person_id']) ? $_post['person_id'] : '';
$page = isset($_post['page']) ? $_post['page'] : '';
$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="update person set login='$login',pws='$pws',question='$question',answer='$answer' where person_id='$person_id'";
$db->query($sql);
forward('修改成功','href','personlist.php?page='.$page);
}
elseif($action=='edit'){
$person_id=$_get['person_id'];
$page=$_get['page'];
$sql="select * from person where person_id='$person_id'";
$query = $db->query($sql);
$row = $db->fetch_array($query);
$login=$row['login'];
$pws=$row['pws'];
$question=$row['question'];
$answer=$row['answer'];
?>
}
else{
$page = isset($_get['page']) ?intval($_get['page']) : 1;
$num = 5;
$sql="select * from person";
$query = $db->query($sql);
$totalnum = $db->num_rows($query);//记录总数
$pagenum = ceil($totalnum/$num); //总页数
$offset = ($page-1) * $num;
$sql=$sql." limit $offset,$num ";
$query = $db->query($sql);//取得记录
?>
记录总数:————添加人员
登陆账号
登陆密码
问题
答案
加入时间
操作
while ($row = $db->fetch_array($query)) {
?>
删除/
修改
}
?>
}
?>

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

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics



1. Open the Douyin app, click [Message] at the bottom of the interface, and click the chat conversation entry that needs to be deleted. 2. Long press any chat record, click [Multiple Select], and check the chat records you want to delete. 3. Click the [Delete] button in the lower right corner and select [Confirm deletion] in the pop-up window to permanently delete these records.

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

Since the launch of ChatGLM-6B on March 14, 2023, the GLM series models have received widespread attention and recognition. Especially after ChatGLM3-6B was open sourced, developers are full of expectations for the fourth-generation model launched by Zhipu AI. This expectation has finally been fully satisfied with the release of GLM-4-9B. The birth of GLM-4-9B In order to give small models (10B and below) more powerful capabilities, the GLM technical team launched this new fourth-generation GLM series open source model: GLM-4-9B after nearly half a year of exploration. This model greatly compresses the model size while ensuring accuracy, and has faster inference speed and higher efficiency. The GLM technical team’s exploration has not

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

The big model subverts everything, and finally got to the head of this editor. It is also an Agent that was created in just one sentence. Like this, give him an article, and in less than 1 second, fresh title suggestions will come out. Compared to me, this efficiency can only be said to be as fast as lightning and as slow as a sloth... What's even more incredible is that creating this Agent really only takes a few minutes. Prompt belongs to Aunt Jiang: And if you also want to experience this subversive feeling, now, based on the new Wenxin intelligent agent platform launched by Baidu, everyone can create their own intelligent assistant for free. You can use search engines, smart hardware platforms, speech recognition, maps, cars and other Baidu mobile ecological channels to let more people use your creativity! Robin Li himself

Table of Contents Astar Dapp Staking Principle Staking Revenue Dismantling of Potential Airdrop Projects: AlgemNeurolancheHealthreeAstar Degens DAOVeryLongSwap Staking Strategy & Operation "AstarDapp Staking" has been upgraded to the V3 version at the beginning of this year, and many adjustments have been made to the staking revenue rules. At present, the first staking cycle has ended, and the "voting" sub-cycle of the second staking cycle has just begun. To obtain the "extra reward" benefits, you need to grasp this critical stage (expected to last until June 26, with less than 5 days remaining). I will break down the Astar staking income in detail,
