Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [SQL][PHP]mysql problem
neruo0
post
Post #1





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 23.11.2012

Ostrzeżenie: (0%)
-----


Witam otóż mam taki problem a mianowice mam tabelkę i chcę do niej pobrac dane z bazy danych. z tabelki nr. i gdy zrobie to to wyświetla mi to ładnie w tabelce etc. ale gdy dodałem już kolejnde dane to wyświtla je pod tabelą sad.gif

img: to co na czerwono powinno byc w tabelce sad.gif

oto kod:
  1. $link=mysql_query("SELECT * FROM nr");
  2. if (mysql_num_rows($link) > 0) {
  3. ?>
  4. <table border=0 style="background: white; text-align: center; margin-left: auto; margin-right: auto">
  5. <tr style="background: lightgreen; text-align: center">
  6. <td style="text-align: center; width: 70px; height=15px"><strong>ID</strong></td>
  7. <td style="text-align: center; width: 130px"><strong>Typ</strong></td>
  8. <td style="text-align: center; width: 200px"><strong>Tresc</strong></td>
  9. <td style="text-align: center; width: 70px"><strong>Nr</strong></td>
  10. <td style="text-align: center; width: 170px"><strong>Koszt</strong></td>
  11. <td style="text-align: center; width: 170px"><strong>Opcje</strong></td>
  12. </tr>
  13. <?php
  14. while($wiersz=mysql_fetch_assoc($link)) {
  15. echo '<td>';
  16. echo $wiersz['id'];
  17. echo '</td>';
  18. echo '<td>';
  19. echo $wiersz['typ'];
  20. echo '</td>';
  21. echo '<td>';
  22. echo $wiersz['tresc'];
  23. echo '</td>';
  24. echo '<td>';
  25. echo $wiersz['nr'];
  26. echo '</td>';
  27. echo '<td>';
  28. echo $wiersz['koszt'];
  29. echo '</td>';
  30. echo ' <td> ';
  31. echo '<form action="nr.php?nr=edytuj&id='.$wiersz['id'].'" method="POST"><input type="submit" value="Edytuj" /></form>';
  32. echo ' </td> ';
  33. echo '</font>';
  34. echo '</div>';
  35. echo '</table>';
  36. }
  37. }
  38. ?>


Z góry thnx za odp
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
Damonsson
post
Post #2





Grupa: Zarejestrowani
Postów: 2 355
Pomógł: 533
Dołączył: 15.01.2010
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


Skoro w pierwszym przejściu pętli zamykasz tabelę, to jak ma być inaczej?
Go to the top of the page
+Quote Post
neruo0
post
Post #3





Grupa: Zarejestrowani
Postów: 3
Pomógł: 0
Dołączył: 23.11.2012

Ostrzeżenie: (0%)
-----


o lol faktycznie biggrin.gif

ok, po usunięciu </table> wyświetla all w jednej lini sad.gif
czyli zaraz obok tego 1 wyglądato tak




POWROT powinno byc na dole sad.gif

@ref

Ten post edytował neruo0 22.12.2012, 11:04:47
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 05:12