• 26.08.2025, 09:41
  • Registrieren
  • Anmelden
  • Sie sind nicht angemeldet.

 

TrOuble

God

html & php Problem ! *erledigt*

Freitag, 2. April 2004, 02:06

Moin ! hab mal (wieder) n problem ... und ich komme (mal wieder) nicht weiter ... *grr*

alsoooo ich bastel Grad an meinem Guestbook ...
leider kommt nur DAS HIER herraus ...

Wieso postet er die nicht untereinander ?!

Quellcode ist folgender :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
      error_reporting(E_ALL);
      
      @mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS) OR 
                              die("Keine Verbindung zur Datenbank. Fehlermeldung:".mysql_error());

      mysql_select_db(MYSQL_DATABASE) OR 
                              die("Konnte Datenbank nicht benutzen, Fehlermeldung: ".mysql_error());
                              
      $sql = "SELECT 
                  Name, 
                  Mail, 
                  Homepage,
                  Inhalt,
                  Datum 
            FROM 
                  gb
            ORDER BY 
                  datum DESC";
      
      $gb = mysql_query($sql) OR die(mysql_error());
      
      echo "<h2>Gästebuch</h2><br \>\n";
      echo "Das Gästebuch hat ".mysql_num_rows($gb)." einträge!<br \><br \><br \>\n";
      echo "<table width=\"500\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\n";
echo  "<tr>\n";
echo    "<td width=\"92\" bgcolor=\"F0F0F0\">\n";
       while($row = mysql_fetch_assoc($gb)) {           
echo $row['Name'];
echo    "</td>\n";
echo    "<td width=\"500\" bgcolor=\"F0F0F0\">²</td>\n";
echo    "<td width=\"131\" bgcolor=\"F0F0F0\">\n";                    
      if(trim($row['Mail']) == "") {
echo      "<a href=\"mailto:".$row['Mail']."\" target=\"_blank\"></a>\n";
}
else {       
echo        "<a href=\"mailto:".$row['Mail']."\" target=\"_blank\"><img src=\"images/email.gif\" width=\"17\" hspace=\"0\" vspace=\"0\" ></a>\n"; 
}                            
      if(trim($row['Homepage']) == "") {
echo      "<a href=\"".$row['Homepage']."\" target=\"_blank\"></a>\n";    
}
      else {
      echo      "<a href=\"http://".$row['Homepage']."\" target=\"_blank\"><img src=\"images/home.gif\" width=\"17\" hspace=\"0\" vspace=\"0\" ></a>\n";    
}
echo  "</td>\n";
echo  "</tr>\n";
echo  "<tr>\n";
echo    "<td bgcolor=\"F0F0F0\">²</td>\n";
echo    "<td>\n";             
echo $row['Inhalt']; 
echo  "</td>\n";
echo  "<td>²</td>\n";
echo  "</tr>\n";
echo  "<tr>\n";
echo    "<td bgcolor=\"F0F0F0\">²</td>\n";
echo    "<td bgcolor=\"F0F0F0\">²</td>\n";
echo    "<td bgcolor=\"F0F0F0\">".$row['Datum']."</a> </td>\n";      
echo  "</tr>\n";
echo  "</table>\n";
echo "<br \>\n";
echo "<p></p>\n";
      }
?>
<br>
<br>
<form name="form1" method="post" action="main.php?page=gb_post">
  <table width="500" border="0" align="center">
    <tr> 
      <td width="90">Name:</td>
      <td><input type="text" name="Name" class="page"></td>
    </tr>
    <tr valign="top"> 
      <td>Kommentar:</td>
      <td><textarea name="Inhalt" rows="3" cols="40" class="page"></textarea></td>
    </tr>
    <tr> 
      <td>Homepage:</td>
      <td><input type="text" name="Homepage" class="page"></td>
    </tr>
    <tr> 
      <td>eMail:</td>
      <td><input type="text" name="Mail" class="page"></td>
    </tr>
    <tr> 
      <td>²</td>
      <td><input type="submit" name="Submit" value="Senden"></td>
    </tr>
  </table>
</form>


Mfg TrOuble

fliegenduennschiss

God

Re: html &amp; php Problem !

Freitag, 2. April 2004, 02:21

mmh... ich kann dir zwar nich direkt helfen, aber wenn ich auf deinen link klicke is alles durcheinander (wie schon gesagt) aber wenn ich im menü auf guestbook klicke werden die posts untereinander angezeigt :-/


cu

TrOuble

God

Re: html &amp; php Problem !

Freitag, 2. April 2004, 02:25

Zitat von »TheCrow«

mmh... ich kann dir zwar nich direkt helfen, aber wenn ich auf deinen link klicke is alles durcheinander (wie schon gesagt) aber wenn ich im menü auf guestbook klicke werden die posts untereinander angezeigt :-/


cu


Moin ! ;)

also ... wennde aufn button klickst kommste auf meine aktuelle guestbook version die online ist ... wennde auf den link klickst den ich hier gepostet habe, kommste zuner test version ;)
(man vergleiche das ende der URL ;)
->link hier im post main.php?page=test
->link auf meiner page main.php?page=guestbook
)

;)

Code Update :

Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
      error_reporting(E_ALL);
      
      @mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS) OR 
                              die("Keine Verbindung zur Datenbank. Fehlermeldung:".mysql_error());

      mysql_select_db(MYSQL_DATABASE) OR 
                              die("Konnte Datenbank nicht benutzen, Fehlermeldung: ".mysql_error());
                              
      $sql = "SELECT 
                  Name, 
                  Mail, 
                  Homepage,
                  Inhalt,
                  Datum 
            FROM 
                  gb
            ORDER BY 
                  datum DESC";
      
      $gb = mysql_query($sql) OR die(mysql_error());
      
echo "<h2>Gästebuch</h2><br \>\n";
echo "Das Gästebuch hat ".mysql_num_rows($gb)." einträge!<br \><br \><br \>\n";
echo "<table width=\"500\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">\n";
      while($row = mysql_fetch_assoc($gb)) {     
            
echo  "<tr>\n";
echo    "<td width=\"92\" bgcolor=\"F0F0F0\">\n";
echo $row['Name'];
echo    "</td>\n";
echo    "<td width=\"500\" bgcolor=\"F0F0F0\">²</td>\n";
echo    "<td width=\"131\" bgcolor=\"F0F0F0\">\n";                    
      if(trim($row['Mail']) == "") {
echo      "<a href=\"mailto:".$row['Mail']."\" target=\"_blank\"></a>\n";
}
      else {       
echo        "<a href=\"mailto:".$row['Mail']."\" target=\"_blank\"><img src=\"images/email.gif\" width=\"17\" hspace=\"0\" vspace=\"0\" ></a>\n"; 
}                            
      if(trim($row['Homepage']) == "") {
echo      "<a href=\"".$row['Homepage']."\" target=\"_blank\"></a>\n";    
}
      else {
      echo      "<a href=\"[url]http://".$row['Homepage']."\"[/url] target=\"_blank\"><img src=\"images/home.gif\" width=\"17\" hspace=\"0\" vspace=\"0\" ></a>\n";    
}
echo  "</td>\n";
echo  "</tr>\n";
echo  "<tr>\n";
echo    "<td bgcolor=\"F0F0F0\">²</td>\n";
echo    "<td>\n";             
echo $row['Inhalt']; 
echo  "</td>\n";
echo  "</tr>\n";
echo  "<tr>\n";
echo    "<td bgcolor=\"F0F0F0\">²</td>\n";
echo    "<td bgcolor=\"F0F0F0\">²</td>\n";
echo    "<td bgcolor=\"F0F0F0\">".$row['Datum']."</a> </td>\n";
echo  "</tr>\n";      
echo  "</table>\n";
echo "<br \>\n";
      }
?>
<br>
<br>
<form name="form1" method="post" action="main.php?page=gb_post">
  <table width="500" border="0" align="center">
    <tr> 
      <td width="90">Name:</td>
      <td><input type="text" name="Name" class="page"></td>
    </tr>
    <tr valign="top"> 
      <td>Kommentar:</td>
      <td><textarea name="Inhalt" rows="3" cols="40" class="page"></textarea></td>
    </tr>
    <tr> 
      <td>Homepage:</td>
      <td><input type="text" name="Homepage" class="page"></td>
    </tr>
    <tr> 
      <td>eMail:</td>
      <td><input type="text" name="Mail" class="page"></td>
    </tr>
    <tr> 
      <td>²</td>
      <td><input type="submit" name="Submit" value="Senden"></td>
    </tr>
  </table>
</form>

TrOuble

God

Re: html & php Problem !

Freitag, 2. April 2004, 02:29

Ädit :

Problem gefunden *ankopfklatsch*

ich hab die tabelle öfters geschlossen als sie geöffnet wurde ...

*narf*

pharao

Moderator

Re: html & php Problem ! *erledigt*

Freitag, 2. April 2004, 03:28

na super. ich les mich durch den Quelltext, komm zum gleichen Ergebnis, will hier posten und du hast es schon selbst gefunden. >:( ;D ;D ;D

Was lernen wir daraus?
1. ordentlich kommentieren (nach jedem </table> kommt ein //Ende von soundso
2. phpedit nehmen, das macht geöffnete tags auch gleich wieder zu
Gute work-live-balance ist, wenn man von seinem Privatleben erschöpfter ist als von der Arbeit.