我想刪除我的MYSQL數據庫中的特定條目。刪除特定的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');
}
}
這與iOS應用程序配對,該應用程序始終抓取當前照片ID。當按下按鈕時,API中的刪除功能將被觸發。這似乎並不奏效。
下面的查詢工作(具體ID):
$result = query("DELETE from photos WHERE IdPhoto=10");
任何幫助,將不勝感激。我們的目標是根據我們在iOS應用中獲取的$ IdPhoto刪除照片。
query()函數返回什麼? – andrewsi
沒什麼特別的。實際上一點都沒有。 – qweqweqwe
那你爲什麼要檢查'$ result ['error']'是否存在,如果query()不返回任何東西? – andrewsi