Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Błąd w html podczas wywoływania errora, Mały błędzik :)
kiepski96
post
Post #1





Grupa: Zarejestrowani
Postów: 233
Pomógł: 0
Dołączył: 22.02.2010

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


Witam,otóż mam problem :

Mam kod,dzięki któremu po przekroczeniu określonej liczby rejestracji ( w poniższym przypadku jest 2 ) wyświetla się tekst "Brak nagrody "

Lecz tak nie jest,nie wyświetla się .
Dane do mysql są ok.

Myślę,że coś pochrzaniłem z html.
Czy mógłbym prosić o kod html, który będzie właśnie wyświetlał ten error ?

Oto mój php :

  1. <?php
  2. if (!isset($_SESSION['username']))
  3. {
  4. header('Location: ./login.php');
  5. }
  6. ?>
  7. <?php
  8. $error_message = "";
  9. $action = isset($_POST['action']) ? $_POST['action'] : '';
  10. $mysql_server = 'localhost';
  11. $mysql_username = 'xxx';
  12. $mysql_password = 'xxx';
  13. $mysql_database = 'xxx';
  14. $mysql_table = 'nagroda1';
  15. $db = mysql_connect($mysql_server, $mysql_username, $mysql_password);
  16. mysql_select_db($mysql_database, $db);
  17. $sql = "SELECT id FROM ".$mysql_table;
  18. $result = mysql_query($sql, $db);
  19. $nagroda1=mysql_num_rows($result);
  20.  
  21. if ($_SERVER['REQUEST_METHOD'] == 'POST' && $nagroda1 >= 2 )
  22. {
  23.  
  24. $error_message = "Pula nagród wyczerpana.";
  25. }
  26. ?>
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
kiepski96
post
Post #2





Grupa: Zarejestrowani
Postów: 233
Pomógł: 0
Dołączył: 22.02.2010

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


Już nie wiem co mam robić. Może dam cały kod :

  1. <?php
  2. if (!isset($_SESSION['username']))
  3. {
  4. header('Location: ./login.php');
  5. }
  6. ?>
  7.  
  8. <?php
  9. $error_message1 = "";
  10. $action = isset($_POST['action']) ? $_POST['action'] : '';
  11. $mysql_server = 'localhost';
  12. $mysql_username = 'xxx';
  13. $mysql_password = 'xxx';
  14. $mysql_database = 'xxx';
  15. $mysql_table = 'nagroda1';
  16. $db = mysql_connect($mysql_server, $mysql_username, $mysql_password);
  17. mysql_select_db($mysql_database, $db);
  18. $sql = "SELECT id FROM ".$mysql_table;
  19. $result = mysql_query($sql, $db);
  20. $nagroda1=mysql_num_rows($result);
  21.  
  22. if ($_SERVER['REQUEST_METHOD'] == 'POST' && $nagroda1 >= 2 )
  23. {
  24. $error_message1 = 'Pula nagród wyczerpana.';
  25. }
  26. else
  27. ?>
  28. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  29. <html>
  30. <head>
  31. <meta http-equiv="Content-Language" content="pl">
  32. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  33. <title>Katalog nagród</title>
  34. <style type="text/css">
  35. div#container
  36. {
  37. width: 1250px;
  38. position: relative;
  39. margin-top: 0px;
  40. margin-left: auto;
  41. margin-right: auto;
  42. text-align: left;
  43. }
  44. </style>
  45. <style type="text/css">
  46. body
  47. {
  48. text-align: center;
  49. margin: 0;
  50. background-color: #FFFFFF;
  51. color: #000000;
  52. }
  53. </style>
  54. <script type="text/javascript">
  55. <!--
  56. function SetImage(id, filename)
  57. {
  58. var elem=document.getElementById(id);
  59. if(elem)
  60. {
  61. elem.src=filename;
  62. }
  63. }
  64. //-->
  65. </script>
  66. </head>
  67. <body>
  68. <div id="container">
  69. <div id="wb_Shape1" style="margin:0;padding:0;position:absolute;left:259px;top:295px;width:745px;heigh
    t:884px;text-align:left;z-index:0;">
  70. <img src="images/img0015.png" id="Shape1" alt="" title="" style="border-width:0;width:745px;height:884px"></div>
  71. <div id="wb_Image1" style="margin:0;padding:0;position:absolute;left:254px;top:46px;width:740px;height
    :168px;text-align:left;z-index:1;">
  72. <img src="images/top.bez.png" id="Image1" alt="" border="0" style="width:740px;height:168px;"></div>
  73. <div id="wb_Image2" style="margin:0;padding:0;position:absolute;left:253px;top:0px;width:105px;height:
    45px;text-align:left;z-index:2;">
  74. <a href="./index.html" onmouseover="SetImage('Image2','images/button-niebieski_01.png');return false;" onmouseout="SetImage('Image2','images/przycisk-szary1_01.png');return false;"><img src="images/przycisk-szary1_01.png" id="Image2" alt="" border="0" style="width:105px;height:45px;"></a></div>
  75. <div id="wb_Image3" style="margin:0;padding:0;position:absolute;left:358px;top:0px;width:105px;height:
    45px;text-align:left;z-index:3;">
  76. <a href="./rejestracja.html" onmouseover="SetImage('Image3','images/button-niebieski_02.png');return false;" onmouseout="SetImage('Image3','images/przycisk-szary1_02.png');return false;"><img src="images/przycisk-szary1_02.png" id="Image3" alt="" border="0" style="width:105px;height:45px;"></a></div>
  77. <div id="wb_Image4" style="margin:0;padding:0;position:absolute;left:463px;top:0px;width:105px;height:
    45px;text-align:left;z-index:4;">
  78. <a href="./oferty.html" onmouseover="SetImage('Image4','images/button-niebieski_03.png');return false;" onmouseout="SetImage('Image4','images/przycisk-szary1_03.png');return false;"><img src="images/przycisk-szary1_03.png" id="Image4" alt="" border="0" style="width:105px;height:45px;"></a></div>
  79. <div id="wb_Image5" style="margin:0;padding:0;position:absolute;left:568px;top:0px;width:105px;height:
    45px;text-align:left;z-index:5;">
  80. <a href="./dowody.html" onmouseover="SetImage('Image5','images/button-niebieski_04.png');return false;" onmouseout="SetImage('Image5','images/przycisk-szary1_04.png');return false;"><img src="images/przycisk-szary1_04.png" id="Image5" alt="" border="0" style="width:105px;height:45px;"></a></div>
  81. <div id="wb_Image6" style="margin:0;padding:0;position:absolute;left:673px;top:0px;width:105px;height:
    45px;text-align:left;z-index:6;">
  82. <a href="./zasady.html" onmouseover="SetImage('Image6','images/button-niebieski_05.png');return false;" onmouseout="SetImage('Image6','images/przycisk-szary1_05.png');return false;"><img src="images/przycisk-szary1_05.png" id="Image6" alt="" border="0" style="width:105px;height:45px;"></a></div>
  83. <div id="wb_Image7" style="margin:0;padding:0;position:absolute;left:778px;top:0px;width:105px;height:
    45px;text-align:left;z-index:7;">
  84. <a href="./wyplata.html" onmouseover="SetImage('Image7','images/button-niebieski_06.png');return false;" onmouseout="SetImage('Image7','images/przycisk-szary1_06.png');return false;"><img src="images/przycisk-szary1_06.png" id="Image7" alt="" border="0" style="width:105px;height:45px;"></a></div>
  85. <div id="wb_Image8" style="margin:0;padding:0;position:absolute;left:883px;top:0px;width:105px;height:
    45px;text-align:left;z-index:8;">
  86. <a href="./forum.html" onmouseover="SetImage('Image8','images/button-niebieski_07.png');return false;" onmouseout="SetImage('Image8','images/przycisk-szary1_07.png');return false;"><img src="images/przycisk-szary1_07.png" id="Image8" alt="" border="0" style="width:105px;height:45px;"></a></div>
  87. <div id="wb_Image9" style="margin:0;padding:0;position:absolute;left:354px;top:326px;width:154px;heigh
    t:240px;text-align:left;z-index:9;">
  88. <a href="./nagroda1.php"><img src="images/godzrestocku.png" id="Image9" alt="" border="0" style="width:154px;height:240px;"></a></div>
  89. <div id="wb_Image10" style="margin:0;padding:0;position:absolute;left:552px;top:326px;width:154px;heigh
    t:240px;text-align:left;z-index:10;">
  90. <img src="images/javelin30.png" id="Image10" alt="" border="0" style="width:154px;height:240px;"></div>
  91. <div id="wb_Image11" style="margin:0;padding:0;position:absolute;left:750px;top:326px;width:154px;heigh
    t:240px;text-align:left;z-index:11;">
  92. <img src="images/pktx2.png" id="Image11" alt="" border="0" style="width:154px;height:240px;"></div>
  93. <div id="wb_Image12" style="margin:0;padding:0;position:absolute;left:354px;top:602px;width:154px;heigh
    t:240px;text-align:left;z-index:12;">
  94. <img src="images/premiumnagrodaeu.png" id="Image12" alt="" border="0" style="width:154px;height:240px;"></div>
  95. <div id="wb_Image13" style="margin:0;padding:0;position:absolute;left:552px;top:602px;width:154px;heigh
    t:240px;text-align:left;z-index:13;">
  96. <img src="images/premka3.png" id="Image13" alt="" border="0" style="width:154px;height:240px;"></div>
  97. <div id="wb_Image14" style="margin:0;padding:0;position:absolute;left:751px;top:602px;width:154px;heigh
    t:240px;text-align:left;z-index:14;">
  98. <img src="images/losowygift.png" id="Image14" alt="" border="0" style="width:154px;height:240px;"></div>
  99. <div id="wb_Shape2" style="margin:0;padding:0;position:absolute;left:413px;top:234px;width:453px;heigh
    t:52px;text-align:center;z-index:15;">
  100. <img src="images/img0016.png" id="Shape2" alt="" title="" style="border-width:0;width:453px;height:52px"></div>
  101. <div id="Html1" style="position:absolute;left:593px;top:459px;width:222px;height:252px;z-index:16">
  102.  
  103. <div id="Html3" style="position:absolute;left:319px;top:302px;width:134px;height:24px;z-index:16">
  104. <?php echo $error_message1;?></div>
  105.  
  106.  
  107.  
  108.  
  109. </div>
  110. </div>
  111. </body>
  112. </html>


Ten post edytował kiepski96 4.04.2011, 16:15:03
Go to the top of the page
+Quote Post

Posty w temacie
- kiepski96   Błąd w html podczas wywoływania errora   2.04.2011, 20:03:38
- - kadlub   [PHP] pobierz, plaintext echo "Pula nagród wy...   2.04.2011, 20:09:22
- - kiepski96   Czy po bezpośrednim wklejeniu tego do tego skryptu...   2.04.2011, 20:17:42
- - mlawnik   Mysle ze tak, ale sproboj. Sorry za ort, zaraz zm...   2.04.2011, 20:29:53
- - kadlub   jak chcesz ten cały kod wstawić w div i coś tam j...   2.04.2011, 20:34:56
- - kiepski96   Nadal nic. Trochę musiałem zmienić . Teraz jest ph...   3.04.2011, 19:56:03
- - kadlub   próbujesz wyświetlić zmienną $error_message1 ...   4.04.2011, 07:29:49
- - kiepski96   Wszystko jest w jednym pliku spis.php, tylko daje ...   4.04.2011, 10:06:49
- - kadlub   [PHP] pobierz, plaintext if ($_SERVER['RE...   4.04.2011, 13:57:23
- - kiepski96   Już nie wiem co mam robić. Może dam cały kod : [P...   4.04.2011, 16:14:39
- - kadlub   [PHP] pobierz, plaintext if ($_SERVER['RE...   4.04.2011, 16:27:38
- - kiepski96   Działa, ale teraz chciałem wywołać wiele błędów i ...   4.04.2011, 17:38:20
- - kadlub   jak wszystkie zapytania ponazywałeś tak samo to ni...   4.04.2011, 17:48:51
- - kiepski96   Teraz mam kłopot,ponieważ nie chce wyświetlić wszy...   4.04.2011, 18:04:54
- - kadlub   pokaż jak teraz ten twój kod wygląda   4.04.2011, 18:08:15
- - kiepski96   Proszę ,cały kod : [PHP] pobierz, plaintext <?...   4.04.2011, 18:13:41
- - kadlub   poczytaj trochę na temat php bo tak będziemy pisać...   4.04.2011, 18:19:17
- - kiepski96   No na początku tak miałem bez else,ale potem mi co...   4.04.2011, 18:21:04


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 - 20:03