Homepage selbermachen 7.846 Themen, 35.563 Beiträge

@ H_M, Xafford oder wer sich auskennt (PHP Problem)

T E S T E R / 2 Antworten / Flachansicht Nickles

Hallo Heinz_Malcher oder Xafford oder an alle, die Ahnung haben,
ich habe ein ähnliches Problem: Ich habe mal meinen Code:

Xaffords Tipp auf H_M\'s Posting hat nicht geklappt. Ich weiss nicht,
wo der Fehler liegt.

MEIN Problem lag darin, dass ich auch jeweils folgende struktur brauche:

<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>


Aber statt dessen immer nur folgende Struktur erscheint:

<tr>
<td> </td>
<td> </td>
<td> </td>

<td> </td>
<td> </td>
<td> </td>

<td> </td>
<td> </td>
<td> </td>
</tr>


Also das <tr> wird bei mir auch nur einmal erzeugt.




<?php

$filename = "text.txt";
$fp = fopen ("$filename", "r");
$inhalt = fread ($fp, filesize ("$filename"));
$zeile=explode("\\n",$inhalt);

print\'<table width="100%" border="1">\';
foreach ($zeile as $inhalt){
print \'<tr>\';
echo "<td border=1>$inhalt</td>";
echo "<td border=1>$inhalt</td>";
echo "<td border=1>$inhalt</td>";
print \'</tr>\';
}
print \'</table>\';

?>





Auch das hier hat nicht funktioniert:



<?php

$filename = "text.txt";
$fp = fopen ("$filename", "r");
$inhalt = fread ($fp, filesize ("$filename"));
$zeile=explode("\\n",$inhalt);

print\'<table width="100%" border="1">\';
foreach ($zeile as $inhalt)
{
<b>foreach ($inhalt as $inhalt2)</b>
print \'<tr>\';
echo "<td border=1>$inhalt</td>";
echo "<td border=1>$inhalt</td>";
echo "<td border=1>$inhalt</td>";
}
print \'</tr>\';
}
print \'</table>\';

?>




bei Antwort benachrichtigen