ppc Posted November 29, 2016 Report Share Posted November 29, 2016 Sveiki, gribēju jautāt, vai tādā veidā var dzēst lietotājus automātiski, ja ir kļūda, lūdzu palīdiet to labot. $del_time = time() - 43200; if (''.$del_time.''){ $id = abs(intval($_GET['id'])); $a = $db->query("SELECT `id`,`foto` FROM `ankets` WHERE `id`='$id'")->fetch_assoc(); $b = $db->query("SELECT `id`,`file` FROM `mail_msg` WHERE `id`='$id'")->fetch_assoc(); $db->query("DELETE FROM `mail_msg` WHERE `user_2` = '$id'"); $db->query("DELETE FROM `mail_msg` WHERE `user_1` = '$id'"); $db->query("DELETE FROM `notice` WHERE `to` = '$id'"); $db->query("DELETE FROM `friend` WHERE `user2` = '$id'"); $db->query("DELETE FROM `friend` WHERE `user1` = '$id'"); $db->query("DELETE FROM `users_likes` WHERE `user` = '$id'"); $db->query("DELETE FROM `users_likes` WHERE `to` = '$id'"); if (!empty($a[foto])) unlink($a[foto]); if (!empty($b[file])) unlink($b[file]); $db->query('DELETE FROM `ankets` WHERE `id` = "'.$id.'"'); } Quote Link to comment Share on other sites More sharing options...
jurchiks Posted November 29, 2016 Report Share Posted November 29, 2016 Izmanto foreign keys un tad šitāda huiņa nebūs jādara. Quote Link to comment Share on other sites More sharing options...
ppc Posted November 29, 2016 Author Report Share Posted November 29, 2016 Izmanto foreign keys un tad šitāda huiņa nebūs jādara. Var piemēru? Quote Link to comment Share on other sites More sharing options...
Val Posted November 29, 2016 Report Share Posted November 29, 2016 Gan jau, ka vari arī pats atrast. http://www.mysqltutorial.org/mysql-foreign-key/ Quote Link to comment Share on other sites More sharing options...
Sasa Posted November 30, 2016 Report Share Posted November 30, 2016 Var nedzēst lai saglabājas vēsturei, pieliec aktivitātes pazīmi un uzseto 0, ja dzēst. Kad jāatlasa atlasa visu kam aktīvs 1. Īsti nav tas ko autors vēlas, bet var padomāt ārpus kastes. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.