andrisp Posted July 14, 2008 Report Share Posted July 14, 2008 Es droši vien pirms tā foreacha izpildītu kveriju, kas izdzēš visus ierakstus attiecīgajam liet_id. Link to comment Share on other sites More sharing options...
Artenis Posted July 14, 2008 Author Report Share Posted July 14, 2008 Sis strādā ļoti jauki līdz brīdim, kad tiek updeitos useris, kas datubāzes tabulāatrodas pirajāvietā, ja no pirmātabulas usera updeito tad tiek izdzēsts viss un pievienoti izvēlētie checkboxi... Ja no cita usera vieno tad tiek pievienoti klāt notīrot jau esošos... if($_POST['pieeja']==""){}else{ while($row = mysql_fetch_assoc($result_pieeja)){ mysql_query("DELETE FROM $tb5 where ".$row['liet_id']."=".$id.""); } foreach($_POST['pieeja'] as $v) { mysql_query("INSERT INTO $tb5 (gal_id,liet_id)VALUES ('".$_POST['pieeja'][$v]."','$id')"); } } Link to comment Share on other sites More sharing options...
andrisp Posted July 14, 2008 Report Share Posted July 14, 2008 $row['liet_id']."=".$id ??? Padomā pats, ko tu tur esi uzrakstījis :) Link to comment Share on other sites More sharing options...
Artenis Posted July 14, 2008 Author Report Share Posted July 14, 2008 (edited) Tas $id ir apzīmēts kā: $id=$_POST['id']; Pašam šķita kaut cik jēdzigi! :) Edited July 14, 2008 by Artenis Link to comment Share on other sites More sharing options...
andrisp Posted July 14, 2008 Report Share Posted July 14, 2008 Nu padomā padomā vēlreiz, kas tev tur notiek tajā kverijā. Link to comment Share on other sites More sharing options...
Artenis Posted July 14, 2008 Author Report Share Posted July 14, 2008 (edited) nu kā kverijs nodzēš visus id, kas man galīgi neder... Tagad sapratu, ka pilnīgi aplami, jādomā tagad kādēļ! P.S. Sapratu tik tagad jāizdomā kāsalikt pareizi! Vēl viens foreach nenāk gadījumā? TIk tad sanāktu dzēst pēc vienādo galeriju id!? Labi, foreach neiet... :) Edited July 14, 2008 by Artenis Link to comment Share on other sites More sharing options...
andrisp Posted July 14, 2008 Report Share Posted July 14, 2008 DELETE FROM $tb5 WHERE liet_id = $id Un nevajag nekādus papildus ciklus. Link to comment Share on other sites More sharing options...
Artenis Posted July 14, 2008 Author Report Share Posted July 14, 2008 Nu ja! Patīk man visu sarežģit + vēl nepareizi sarežģīt! Atkal milzigs paldies tev! :) Link to comment Share on other sites More sharing options...
Recommended Posts