当前位置:网站首页>Add, delete, modify and query curd in PHP native SQL
Add, delete, modify and query curd in PHP native SQL
2022-06-26 04:17:00 【Never bow】
Reprint https://blog.csdn.net/weixin_43993175/article/details/104961925
<?php
header("Content-type: text/html; charset=utf-8");
$ip = $_REQUEST['ip']; //ip
$time = time(); // Creation time
$content = $_REQUEST['content']; // Content
// Connect to database database host Address account number password Table name
$conn = mysqli_connect("localhost", 'root', "root", 'bd');
// Query the database
$sql = "select * from bd where ip = '$ip' order by id desc LIMIT 1";
$query = $conn->query($sql);
//$a=[];
while ($row = $query->fetch_array()) {
echo $row['id'], '<br>';
//array_push($a,$row);
}
// insert data
$sql = "insert into bd (ip,time,content) value ('$ip','$time','$content')";
$result = mysqli_query($conn, $sql);
// Modifying data
$sql = "UPDATE table_name SET field1=new-value1, field2=new-value2";
$result = mysqli_query($conn, $sql);
if(!$result)
{
die(' Unable to update data : ' . mysqli_error($conn));
}
// Delete data
$sql = "DELETE FROM runoob_tbl WHERE runoob_id=3";
$result = mysqli_query($conn, $sql);
边栏推荐
- pip 批量完全卸载包
- NFT creation and binding of BSC and HT chains
- Detailed explanation of widget construction process of fluent
- 一幅脑图总结一下需求分析(工作上实际遇到的情况的补充)
- Threejs special sky box materials, five kinds of sky box materials are downloaded for free
- What preparations should be made to develop an app from scratch
- Chrome page recording and playback function
- Swagger
- [Flink] a brief analysis of the writing process of Flink sort shuffle
- English version of ternary loss
猜你喜欢

一幅脑图总结一下需求分析(工作上实际遇到的情况的补充)

Tencent Interviewer: How did binder get its system services?

Nailing open platform - applet development practice (nailing applet server side)

High performance computing center roce overview

Minecraft 1.16.5 生化8 模组 1.9版本 1.18版本同步
![[Qunhui] no port access (reverse proxy + intranet penetration)](/img/bc/b1e0c5c382e30fbcea28fbc68c1151.jpg)
[Qunhui] no port access (reverse proxy + intranet penetration)

What should I do if the 51 SCM board cannot find the device in keil

How to use EEPROM in 51 Single Chip Microcomputer?

Understand CGI and fastcgi

Dix critères de base importants pour les essais de débogage de logiciels
随机推荐
Go time package: second, millisecond, nanosecond timestamp output
R language and machine learning
MySQL's built-in performance testing tool, mysqlslap, performs stress testing
ctf [RoarCTF 2019]easy_ calc
Custom parameter QR code picture combined with background picture to generate new picture node environment
Sorting out the knowledge points of the renderview renderobject parentdata of the shuttle
But the Internet began to have a new evolution and began to appear in a new state
线程同步之互斥量(互斥锁)
How to use EEPROM in 51 Single Chip Microcomputer?
ipvs之ipvs0网卡
Ipvs0 network card of IPVS
List of provinces, cities and counties in China
[QT] dialog box
Introduction Guide to the flutterplugin plug-in in the actual combat of flutter
軟件調試測試的十大重要基本准則
matplotlib折线图,文字显示,win10
Knowledge of functions
CTF PHP audit bypasses filtering learning from topics
High performance computing center roce overview
Analysis report on development status and future trend of CMOS image sensor industry in China 2022 ~ 2028