Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Wpisy w bazie., Jeden id jest a, drugiego nie ma.
Mazur_pl
post
Post #1





Grupa: Zarejestrowani
Postów: 87
Pomógł: 0
Dołączył: 11.05.2007

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


Więc dałem taki kod:
  1. <?php
  2. while($row = mysql_fetch_assoc($album)) {
  3. $katalog_name = $row['nazwa'];
  4. $katalog_nr = $row['nr'];
  5. }
  6. ?>


A potem dałem:
  1. <?php
  2. } elseif($_GET['action'] == $katalog_nr) {
  3.  
  4. if($_GET['show'] == "") {
  5.  
  6. echo('To jest katalog ' . $katalog_name . ' ma on id: ' . $katalog_nr);
  7. ?>


I mam taki problem. W bazie mam trzy wpisy 1,2 i 3.
Kiedy dam w adresie ?action=3 to pisze :

To jest katalog Natura ma on id: 3

A kiedy dam 2 to pisze że nie istnieje katalog chociaż istnieje (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) .
Jak zrobić aby odczytywało resztę wpisów?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
Mazur_pl
post
Post #2





Grupa: Zarejestrowani
Postów: 87
Pomógł: 0
Dołączył: 11.05.2007

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


  1. <?php
  2.  
  3. define("db_host", "localhost");
  4. define("db_user", "Mazur");
  5. define("db_password", "****");
  6. define("db_name", "gl");
  7.  
  8. mysql_connect(db_host, db_user, db_password);
  9. mysql_select_db(db_name);
  10.  
  11. $file_name = "./cms/zdjecia/"; //Sciezka do folderu ze zdjeciami ...
  12.  
  13. $album = mysql_query("SELECT * FROM album__katalog;");
  14.  
  15. while($row = mysql_fetch_assoc($album)) {
  16. $katalog_name = $row['nazwa'];
  17. $katalog_nr = $row['nr'];
  18. }
  19.  
  20. if(!(file_exists("$file_name"))) {
  21.  
  22. echo("Plik $file_name nie istnieje!<br />");
  23.  
  24. } else {
  25.  
  26. if($_GET['action'] == "") {
  27.  
  28. echo('Galeria');
  29.  
  30. } elseif($_GET['action'] == $katalog_nr) {
  31.  
  32. if($_GET['show'] == "") {
  33.  
  34. echo('To jest katalog ' . $katalog_name . ' ma on id: ' . $katalog_nr);
  35.  
  36. } elseif($_GET['show'] == $img_id) {
  37.  
  38. echo('To jest obrazek ' . $img_title);
  39.  
  40. } else {
  41.  
  42. echo('Wpisany obrazek nie istnieje!');
  43.  
  44. }
  45.  
  46. } else {
  47.  
  48. echo('Wpisany katalog nie istnieje!');
  49.  
  50. }
  51. }
  52. ?>


Ten post edytował Mazur_pl 16.05.2007, 16:21:42
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: 5.10.2025 - 11:28