Delete positions with tracks in deleteAll
This commit is contained in:
parent
65a5c95f67
commit
4ddbbb9807
@ -155,14 +155,19 @@
|
||||
public static function deleteAll($userId) {
|
||||
$ret = false;
|
||||
if (!empty($userId)) {
|
||||
$query = "DELETE FROM `" . self::db()->table('tracks') . "` WHERE user_id = ?";
|
||||
$stmt = self::db()->prepare($query);
|
||||
$stmt->bind_param('i', $userId);
|
||||
$stmt->execute();
|
||||
if (!self::db()->error && !$stmt->errno) {
|
||||
$ret = true;
|
||||
// remove all positions
|
||||
if (uPosition::deleteAll($userId) === true) {
|
||||
// remove all tracks
|
||||
$query = "DELETE FROM `" . self::db()->table('tracks') . "` WHERE user_id = ?";
|
||||
$stmt = self::db()->prepare($query);
|
||||
$stmt->bind_param('i', $userId);
|
||||
$stmt->execute();
|
||||
if (!self::db()->error && !$stmt->errno) {
|
||||
$ret = true;
|
||||
}
|
||||
$stmt->close();
|
||||
}
|
||||
$stmt->close();
|
||||
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
@ -100,11 +100,7 @@
|
||||
public function delete() {
|
||||
$ret = false;
|
||||
if ($this->isValid) {
|
||||
// remove positions
|
||||
if (uPosition::deleteAll($this->id) === false) {
|
||||
return false;
|
||||
}
|
||||
// remove tracks
|
||||
// remove tracks and positions
|
||||
if (uTrack::deleteAll($this->id) === false) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user