comparison msite.inc.php @ 1032:9fffc9e7e1b6

Add stDeleteCompoEntry() and use it.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 19 Nov 2015 21:57:19 +0200
parents 35a00a986f79
children 03f4b70a2ce8
comparison
equal deleted inserted replaced
1031:bada991641ba 1032:9fffc9e7e1b6
1343 1343
1344 return stExecSQLCond($sql, "OK, entry added."); 1344 return stExecSQLCond($sql, "OK, entry added.");
1345 } 1345 }
1346 1346
1347 1347
1348 function stDeleteCompoEntry($id)
1349 {
1350 // Delete entry itself
1351 $sql = stPrepareSQL("DELETE FROM entries WHERE id=%d", $id);
1352 stExecSQLCond($sql, "OK, entry ".$id." deleted.");
1353
1354 // Delete votes for the entry
1355 $sql = stPrepareSQL("DELETE FROM votes WHERE entry_id=%d", $id);
1356 stExecSQLCond($sql, "OK, entry ".$id." votes deleted.");
1357
1358 // Mark related files to be deleted
1359 $sql = stPrepareSQL("UPDATE files SET deleted=%d WHERE entry_id=%d", 1, $id);
1360 stExecSQLCond($sql, "OK, entry ".$id." files marked.");
1361 }
1362
1363
1348 ?> 1364 ?>