anonīms Posted March 16, 2008 Report Share Posted March 16, 2008 (edited) http://paste.php.lv/6986 Kā varētu izveidot, ka ieķeksētās vēstules tiek izdzēstas un kā viņš vispār pārbaudītu vai ir ieķeksēts? Edited March 16, 2008 by anonīms Link to comment Share on other sites More sharing options...
bubu Posted March 16, 2008 Report Share Posted March 16, 2008 Forumā jau N-reizes apspriesta lieta. Pameklē searčā. Link to comment Share on other sites More sharing options...
anonīms Posted March 16, 2008 Author Report Share Posted March 16, 2008 Atradu šo, bet tur uz beigām ir ar javascript, ko es vispār nepārzinu. http://php.lv/f/index.php?showtopic=5785 Izveidoju šādu <input type='checkbox' value='".$sanemtaas['0']."' name='checked[]' /> un šādu if($_POST['checked[]'] && $_POST['dzest_vestules']) { mysql_query("DELETE FROM vestules WHERE id = '$_POST[checked]'"); echo "DELETE FROM vestules WHERE id = '$_POST[checked]'"; } bet nu viņš neiet. Link to comment Share on other sites More sharing options...
localhero Posted March 16, 2008 Report Share Posted March 16, 2008 (edited) html: <input type="checkbox" name="id[]" value="id"> php: foreach($_POST["id"] as $id) { $rezultats = mysql_query("DELETE * FROM maili WHERE id= '$id'"); } Edited March 16, 2008 by localhero Link to comment Share on other sites More sharing options...
anonīms Posted March 16, 2008 Author Report Share Posted March 16, 2008 http://paste.php.lv/6987 nestrādā :\ Link to comment Share on other sites More sharing options...
localhero Posted March 16, 2008 Report Share Posted March 16, 2008 Kads errors ? macies debugot savu kodu. programet ir loti viegli ja maki debugot kodu. Link to comment Share on other sites More sharing options...
anonīms Posted March 16, 2008 Author Report Share Posted March 16, 2008 errors nekāds neizlec. iespējams <form> ir nepareizi izveidots? Link to comment Share on other sites More sharing options...
Val Posted March 16, 2008 Report Share Posted March 16, 2008 forma nopostējas? kas ir iekš $_POST tb print_r($_POST); katru dzēšanas kveriju liec lai izdrukā uz ekrāna pie izpildīšanas. un vispār: IZLASI pēdējo localhero postu a nafigam Tev <form> ir trešā rindā no apakšās un nav norādīts method="pats_izdomaa_kam_te_jaabuut"? un piedomā pie koda indentācijas Link to comment Share on other sites More sharing options...
localhero Posted March 16, 2008 Report Share Posted March 16, 2008 Jā formai ir vajadziga metode POST vai GET. Un ievieto skriptā sekojošu rindiņu: var_dump($_POST). Un iekopē te ko viņa tev izvada ? Link to comment Share on other sites More sharing options...
anonīms Posted March 16, 2008 Author Report Share Posted March 16, 2008 (edited) Array ( [id] => ) viņš to id nedabū var_dumb { ["id"]=> NULL } <form method=\"POST\"> <input type='submit' value='dzēst vēstules (Nestrādā)' /> </form> un tiešām <post> bija nepareizajā vietā. tagad izlec sintakses errors, ko atrisināšu gan jau pats :] Edited March 16, 2008 by anonīms Link to comment Share on other sites More sharing options...
localhero Posted March 16, 2008 Report Share Posted March 16, 2008 Hahaha vecit ta jau nevares. Tev tas <input> ir jaiekljauj formaa, jo tam ir jabut formas sastavdaljai ja tu gribi lai kaut kas nopostejas. Pamegini taa un atkal iemet var_dump. <form method="post"> <input type="checkbox" name="id[]" value="id"> <input type='submit' value='dzēst vēstules (Nestrādā)' /> </form> Link to comment Share on other sites More sharing options...
anonīms Posted March 16, 2008 Author Report Share Posted March 16, 2008 zinu, paskatijos, ko Val teica :] Bet tagad ar to sintaksi. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM vestules WHERE id = '12'' at line 1 foreach($_POST["id"] as $vest_id) { mysql_query("DELETE * FROM vestules WHERE id = '$vest_id'") or die(mysql_error()); echo "DELETE * FROM vestules WHERE id = '$vest_id'"; } kļūdu neredzu :\ Link to comment Share on other sites More sharing options...
localhero Posted March 16, 2008 Report Share Posted March 16, 2008 tev nevajag asteriksu (*) pie delete nonjem asteriksu un pamegini. Link to comment Share on other sites More sharing options...
anonīms Posted March 16, 2008 Author Report Share Posted March 16, 2008 (edited) sapratu :] foreach($_POST["id"] as $vest_id) { mysql_query("DELETE FROM vestules WHERE id = '$vest_id'") or die(mysql_error()); echo "DELETE * FROM vestules WHERE id = '$vest_id'"; } Liels paldies :] tagad viss iet. Edited March 16, 2008 by anonīms Link to comment Share on other sites More sharing options...
localhero Posted March 16, 2008 Report Share Posted March 16, 2008 Visi kadreiz ir bijusi iesaceji. Tikai citi ir sakushi macities pashi bet, citi ta ari kope kodu no interneta un prasa katru sikako jautajumu forumos. Un neaizmirsti debugot visu ja kaut kas neiet tas ir loti svarigi. Link to comment Share on other sites More sharing options...
Recommended Posts