Statement preprocessing: Generally speaking, it is a query and multiple executions. It will be often used in our later projects.
Creation:
//Creation preprocessing
$createinto=$connent->prepare("insert into zh(name,age,email) values (?,?,?)");
sql statement, the parameters use? instead of reserved
//绑定 $createinto->bind_param("sis",$name,$age,$email);
The binding parameter s is String type i is int type
$name="zhanghao1"; $age=1; $email="1234123123@qq.com"; $createinto->execute(); $name="zhanghao2"; $age=2; $email="1234123123@qq.com"; $createinto->execute();
Execute the statement; finally the data is inserted successfully. (The premise is to connect to the database and use)
Delete the specified entry:
mysqli_query($connent,"delete from zh where name='zhanghao1'");
Delete the entire table data without adding where conditions
Update the specified entry:
mysqli_query($connent,"update zh set age=3 where name='zhanghao2'");
Modify zhanghao2’s age to 3
Close the database after all database operations are completed.
----Complete code-------
connect_error){ die("连接失败: " . $connent->connect_error); }else{ echo "成功"; } //创建预处理 $createinto=$connent->prepare("insert into zh(name,age,email) values (?,?,?)"); //绑定 $createinto->bind_param("sis",$name,$age,$email); //多次执行 $name="zhanghao1"; $age=1; $email="1234123123@qq.com"; $createinto->execute(); $name="zhanghao2"; $age=2; $email="1234123123@qq.com"; $createinto->execute(); echo "插入成功"; //删除数据 删除表中 name为zhanghao1的数据 mysqli_query($connent,"delete from zh where name='zhanghao1'"); mysqli_query($connent,"update zh set age=3 where name='zhanghao2'"); $connent->close(); ?>
We can find that where is the basis for judging conditions. According to it, we can conditionally query, Condition deletion and condition modification.

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 Chinese version
Chinese version, very easy to use

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

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.

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

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.
