Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP]Jak przekazać parametr
-szczotkap-
post
Post #1





Goście







Witam.

Chciałbym zrobić mały system do rezerwacji.
Mój kod pobiera z MySql z tabeli dane i wyświetla je na stronie:

[Musiałam wyciąć bo Geshi zwariowało]

Co robię źle. Jak rozwiązać ten problem?
Powód edycji: [Daiquiri]: Wycinka
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
sorex
post
Post #2





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 23.08.2010

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


No tak. Przeoczenie. Dzieki Daiquiri.

Mam kolejne pytanie.
Kod pobiera i wyświetla mi z tabeli dane tj. na zdjęciu:

Zrzut wyniku z bazy


Mój działający kod to:
  1. <?php
  2. // Connects to your Database
  3. mysql_connect("admin", "admin", "admin") or die(mysql_error());
  4. $data = mysql_query("SELECT * FROM terminy")
  5.  
  6. while($info = mysql_fetch_array( $data ))
  7. {
  8.  
  9. Print "<table border=5 cellpadding=4 width=700>";
  10. Print "<tr>";
  11. Print "<th>Termin:</th> <td bgcolor=#133481 align=center width=250> ".$info['nazwa_terminu'] . "</td> ";
  12. Print " <td bgcolor=#133481 align=center width=50>".$info['rok'] . " </td>";
  13. Print "<th width=150>Ilość wolnych miejsc:</th> <td align=center width=20>".$info['wolne_miejsca'] . " </td>";
  14. Print "<td align=center width=50><form action=dodaj1.php method=GET><input type=hidden name=rezerw value=".$info['id'] . " ><input type=submit value=Rezerwuj></form></td>";
  15. Print "</tr>";
  16. Print "</table>";
  17. }
  18.  
  19.  
  20. ?>


Co mam zrobić, żeby uzyskać taki efekt: Jeśli ilość wolnych miejsc jest równa zero to przycisk Rezerwuj będzie nieaktywny?
Zacząłem przerabiać ten kod, jednak utknąłem (IMG:style_emoticons/default/sad.gif)

  1. <?php
  2. mysql_connect("admin", "admin", "admin") or die(mysql_error());
  3. $data = mysql_query("SELECT * FROM terminy")
  4.  
  5. $info = mysql_fetch_array( $data );
  6. $info1=$info[wolne_miejsca];
  7.  
  8. if($info1 == 0)
  9. {
  10. Print "<table border=5 cellpadding=4 width=700>";
  11. Print "<tr>";
  12. Print "<th>Termin:</th> <td bgcolor=#133481 align=center width=250> ".$info['nazwa_terminu'] . "</td> ";
  13. Print " <td bgcolor=#133481 align=center width=50>".$info['rok'] . " </td>";
  14. Print "<th width=150>Ilość wolnych miejsc:</th> <td align=center width=20>".$info['wolne_miejsca'] . " </td>";
  15. Print "<td align=center width=50><form action=dodaj1.php method=GET><input type=hidden name=rezerw value=".$info['id'] . " ><input type=submit value=Rezerwuj></form></td>";
  16. Print "</tr>";
  17. Print "</table>";
  18. };
  19.  
  20.  
  21.  
  22. ?>
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 15.10.2025 - 22:29