Home > Backend Development > PHP Tutorial > php关于数据库修改删除有关问题

php关于数据库修改删除有关问题

WBOY
Release: 2016-06-13 13:32:46
Original
728 people have browsed it

php关于数据库修改删除问题
在php中利用MYSQL数据库对发帖进行删除修改的操作,该怎样做啊,求答,谢谢

------解决方案--------------------
一般都是读出帖子的id,然后再根据传入删除操作页面的帖子id参数来删除帖子。
------解决方案--------------------
用三个sql语句完成

INSERT INTO `te` (`1`, `2`, `3`, `4`, `5`) VALUES ('1', '2', '3', '4', '5');
UPDATE `te` SET `2`='x', `3`='x', `4`='x' WHERE `1`='1' AND `2`='2' AND `3`='3' AND `4`='4' AND `5`='5' LIMIT 1;
DELETE FROM `te` WHERE `1`='1' AND `2`='x' AND `3`='x' AND `4`='x' AND `5`='5' LIMIT 1;
------解决方案--------------------

探讨
一般都是读出帖子的id,然后再根据传入删除操作页面的帖子id参数来删除帖子。

------解决方案--------------------
得到主键
delete from tablename where id=?
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template