![]() |
![]() ![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 48 Pomógł: 0 Dołączył: 11.02.2008 Ostrzeżenie: (0%) ![]() ![]() |
Witam,
Nie mogę poradzić sobie z takim o to problemem: Formularz: Kod <input type="checkbox" name="tablica[]" value="<?php echo $row['id_przelewu'] ?>"></td> Odebranie danych (tablica): Kod $tablica = $_POST['tablica']; if(empty($tablica)) { echo '<center><span id="error" class="error">Transfer nie powiódł się!</span></center><br />'; }else{ $checked = $tablica; foreach($checked as $transferuj) { $sql = mysql_query("UPDATE przelewy SET pole_przelewu='1' WHERE id_przelewu='$transferuj'") or die("Nie moge poprawić"); //tworzenie pliku txt $zapytanie = "SELECT * FROM przelewy WHERE id_przelewu='$transferuj'"; $result = mysql_query($zapytanie); $totalNumRows = mysql_num_rows($result); $file = 'plik.txt'; $fp = fopen($file, "w"); flock($fp, 2); while($rekord = mysql_fetch_assoc($result)){ fwrite($fp, $rekord['dane_1'].','); fwrite($fp, $rekord['dane_2'].','); fwrite($fp, "\n\r"); } flock($fp, 3); fclose($fp); } Część update wykonywany jest poprawnie, nawet przy kliku elementach z tablicy. Problem pojawia się przy zapisie do pliku gdzie zapisywany jest tylko ostatni rekord z tablicy? Gdzie tu jest błąd ? Z góry dzięki za pomoc. Pozdr |
|
|
![]()
Post
#2
|
|
![]() Grupa: Zarejestrowani Postów: 8 068 Pomógł: 1414 Dołączył: 26.10.2005 Ostrzeżenie: (0%) ![]() ![]() |
Cytat 'w' Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
|
|
|
![]()
Post
#3
|
|
Grupa: Zarejestrowani Postów: 48 Pomógł: 0 Dołączył: 11.02.2008 Ostrzeżenie: (0%) ![]() ![]() |
ar+ pomogło.
Dzięki. |
|
|
![]() ![]() |
![]() |
Aktualny czas: 19.08.2025 - 16:27 |