使用PHP将文件删除到MySQL数据库中

问题描述:




首先,我自学PHP和MYSQL,我看到你的指南使用PHP将文件上传到MySQL数据库。这是很棒的指南和响应。


我的问题是我现在如何从上面创建的指南中删除文件,


谢谢

Hi,

First off I am self learning PHP and MYSQL, which I saw your guide on "Uploading files into a MySQL database using PHP" and this was great guide and responses that had came through.

My question is how do I now remove files from the guide that you have created above,

thanks

从数据库中删除它们(使用DELETE查询并传递PK)。
delete them from the database (using a DELETE query and passing the PK).


你好Dormilich,

抱歉PK是主键?


我怎么会这样做,因为我正在考虑创建list_files.php中链接的删除文件,以便在打开时我可以查看我要下载的文件或者删除。


感谢您的回复
Hi Dormilich,
Sorry is PK the primary key?

how would I go about this as I was thinking to create the delete file that is linked in the list_files.php so that when open I can then view the files that I want to download or delete.

thanks for the reply



抱歉,PK是主键吗?
Sorry is PK the primary key?



正确。


删除文件应该这样做,从数据库中删除所选条目。

list_files.php中所需要的只是一个调用删除脚本的链接/表单,向其传递要删除的文件的ID(PK)。

correct.

the delete file should do just this, delete the chosen entry from the DB.
all you need in the list_files.php is a link/form that calls the delete script passing it the ID (PK) of the file to be deleted.