Vebers Posted November 7, 2005 Report Share Posted November 7, 2005 Es ar $_POST['nr'] sanjemu ieprieksh nezinaamu skaitu ar cipariem (lauku id) kurus nepiecieshams izdzeest no tabulas. apmeeram sanjemamie $_POST['nr'] : array(3) { [0]=> string(2) "86" [1]=> string(2) "75" [2]=> string(2) "72" } Jautaajums: Kaa vislabaak uztaisiit pieprasiijumu mysql, lai nebuutu katram $_POST['nr']['nummurs'] savs pieprasijums piem.: for($i=0;$i<count($_POST['nr']);$i++){ $nr=$_POST['nr'][$i]; mysql_query("DELETE FROM tabula WHERE id='$nr'"); } taadaa veidaa sanaak bremze, ja ljoti daudz ierakstu jaadzeesh... Link to comment Share on other sites More sharing options...
hu_ha Posted November 7, 2005 Report Share Posted November 7, 2005 sataisi no tām vērtībām where izteiksmes stringu un izpildi vaicājumu vienreiz. vari izmantot or delete from `tabula` where id=1 ir id=3 or id=4; vai in komandu: delete from `tabula` where id in(1,3,4); Link to comment Share on other sites More sharing options...
Vebers Posted November 7, 2005 Author Report Share Posted November 7, 2005 hmm.. a kaa vinjus taa efektiivak salikt vienaa stringaa ? Link to comment Share on other sites More sharing options...
bubu Posted November 7, 2005 Report Share Posted November 7, 2005 (edited) if ($_POST['nr']) { mysql_query('DELETE FROM tabula WHERE id IN ('.implode(',',$_POST['nr']).')') or echo mysql_error(); } Pirms tam tikai obligāti pārliecinies vai tajā $_POST['nr'] ir korektas vērtības. Citādi lietotājs iebaros sazin ko.. Edited November 7, 2005 by bubu Link to comment Share on other sites More sharing options...
Vebers Posted November 7, 2005 Author Report Share Posted November 7, 2005 Paldies, ar sho tagad viss buutu Ok, bet tagad kaa lai uztaisu update visiem shiem laukiem ? //~ DB struktuura id | vieta 82| 0 94| 0 tatad visus shos id nepiecieshams uzpdeitot un uzlikt "vieta='1'" Link to comment Share on other sites More sharing options...
Grey_Wolf Posted November 7, 2005 Report Share Posted November 7, 2005 Paldies, ar sho tagad viss buutu Ok, bet tagad kaa lai uztaisu update visiem shiem laukiem ? Tieshi taapat ... :) WHERE straadaa arii prieksh UPDATE UPDATE `test` SET `a` = '1' WHERE `id` =1 Link to comment Share on other sites More sharing options...
Vebers Posted November 7, 2005 Author Report Share Posted November 7, 2005 aa nu jaa.. dooh, laikam paarkodeejies.. shodien jaamet miers .. Link to comment Share on other sites More sharing options...
Recommended Posts