gpt4 book ai didi

php - 删除特定的 MySQL 数据库条目

转载 作者:可可西里 更新时间:2023-11-01 08:18:20 24 4
gpt4 key购买 nike

我正在尝试删除我的 MYSQL 数据库中的特定条目。

数据库:PhotoID、IDCount、UserID。

这是我根据 ID 删除照片的代码。

function delete($IdPhoto) {

$result = query("DELETE from photos WHERE IdPhoto='%d'", $IdPhoto);
if (!$result['error']) {
// if no error occured, print out the JSON data of the
// fetched photo data
print json_encode($result);
} else {
//there was an error, print out to the iPhone app
errorJson('Photo stream is broken');
}
}

这与始终获取当前照片 ID 的 iOS 应用程序配对。按下按钮时,将触发 API 中的删除功能。但这似乎不起作用。

以下查询有效(特定 ID):

    $result = query("DELETE from photos WHERE IdPhoto=10");

如有任何帮助,我们将不胜感激。目标是根据我们在 iOS 应用程序中抓取的 $IdPhoto 删除照片。

最佳答案

试试这个:

$result = query("DELETE from photos WHERE IdPhoto={$IdPhoto}");

关于php - 删除特定的 MySQL 数据库条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17750073/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com