Brauche dringend hilfe

I

i125

Was stimmt an diesem Script nicht?

PHP:
$datei = "$systempfad/$REMOTE_ADDR.funktion";
$array = file($datei);
for($x=0;$x<count($array);$x++)
{
$wert[$x] = $array[$x];
}
unset($datei);
$endwert = $x;

PHP:
$n = 1;
						do {
							echo $n;
							if ($pruefung == $array[$n]) {
							echo $tablex1, $bild, $tablex2, $mak1, $Eintrag, $mak2, $Eintrag, $mak3, $tablex3, $filesize, $tablex4, $filetype, $abstand, $funktionrename, $link1, $link2, $link3,$tablex5;
							}
							else {
							echo $table1, $bild, $table2, $mak1, $Eintrag, $mak2, $Eintrag, $mak3, $table3, $filesize, $table4, $filetype, $abstand, $funktionrename, $link1, $link2, $link3,$table5;
							}
						$n++;
						} while ($n == $endwert);

Gruss Alexander

PS. Ich knabere schon seit 5 Stunden drann
 
for($x=0;$x<count($array);$x++)

{

$wert[$x] = $array[$x];

}

sach mal was haste denn da vor ???

so ist der code sinnlos :-)
 
Vielleicht kannst du mal sagen, welchen Fehler du bekommst? Das würde die ganze Sache etwas vereinfachen... :)

antihero
 
Jetzt raf ich garnichts mehr....

Also mein Code sieht wie folgt aus:
PHP:
$n = 1;
                        do {
                            echo $n;
                            if ($pruefung == $array[$n]) {
                            echo $tablex1, $bild, $tablex2, $mak1, $Eintrag, $mak2, $Eintrag, $mak3, $tablex3, $filesize, $tablex4, $filetype, $abstand, $funktionrename, $link1, $link2, $link3,$tablex5;
                            }
                            else {
                            echo $table1, $bild, $table2, $mak1, $Eintrag, $mak2, $Eintrag, $mak3, $table3, $filesize, $table4, $filetype, $abstand, $funktionrename, $link1, $link2, $link3,$table5;
                            }
                        $n++;
                        } while ($n < statt == $endwert);
Aber das funktioniert auch nicht...

Der Sinn liegt folgender maßen
Ich lasse mit eine Texdatei in einem Array laden.
Bei der Ausgabe des Dateiverzeichnis soll geprüft werden ob der Pfad == dem Pfad aus dem Verzeichnis übereinstimmt, dann soll er diesen Wert makieren.

Bei einem Eintrag tut er das auch, bei mehreren nicht mehr! Anscheinend durchsucht die Schleife nicht alle Arrays.
 
Genaue Problem beschreibung:
PHP:
     do {
                            echo $n;
                            if ($pruefung == $array[$n]) {
                            echo $tablex1, $bild, $tablex2, $mak1, $Eintrag, $mak2, $Eintrag, $mak3, $tablex3, $filesize, $tablex4, $filetype, $abstand, $funktionrename, $link1, $link2, $link3,$tablex5;
                            }
                            else {
                            echo $table1, $bild, $table2, $mak1, $Eintrag, $mak2, $Eintrag, $mak3, $table3, $filesize, $table4, $filetype, $abstand, $funktionrename, $link1, $link2, $link3,$table5;
                            }
                        $n=$n+1;
                        } while ($n < $endwert);

Das komische Ding da funktioniert zwar, aber er überprüft anscheinend nur den letzten aus dem Array, obwohl ich dem Sage das er alle Arrays überprüfen soll!
 
Hm, du setzt anfangs $x = 0 und $endwert = $X, also 0!
Und $n auf 1, sollte aber 0 sein da dein Array mit 0 beginnt!

Setze $endwert mal = count($array) und $n = 0!
 
Das Problem hat ich gelöst:

Bei der Ausgab der Textdatei hat de Befehl fgets den Zeilenumburch als Abstatz angezeigt und:

-asd - ist ja ein unterschied zu -asd-

Also Sieht mein Script jetzt wie folg aus, um auch euch die Lösung mitzuteilen:

PHP:
//END
				$abstand = " ";	
					if (file_exists("$systempfad/$REMOTE_ADDR.funktion")) {
					$pruefung = $rootlocal;
					$pruefung .= "/";
					$pruefung .= $Eintrag;
					
					$Datei = fopen("$systempfad/$REMOTE_ADDR.funktion", "r");
					$Text = fread($Datei, 100000);
					fclose($Datei);
					unset($Datei);
					
					
					$Muster = "(::)"; 
					$Fundstellen = split($Muster, $Text);
					foreach($Fundstellen as $Abschnitt) {
						if ($pruefung == $Abschnitt) {
						echo "true";
						}
						else {
						echo "false";
						}
						echo "<br>";
					}													  
						//if (isset($funktion)) {
						//echo $tablex1, $bild, $tablex2, $mak1, $Eintrag, $mak2, $Eintrag, $mak3, $tablex3, $filesize, $tablex4, $filetype, $abstand, $funktionrename, $link1, $link2, $link3,$tablex5;
						//unset($funktion);
						//}
						//else {
						//echo $table1, $bild, $table2, $mak1, $Eintrag, $mak2, $Eintrag, $mak3, $table3, $filesize, $table4, $filetype, $abstand, $funktionrename, $link1, $link2, $link3,$table5;
						//}
					}		
					else {
					echo $table1, $bild, $table2, $mak1, $Eintrag, $mak2, $Eintrag, $mak3, $table3, $filesize, $table4, $filetype, $abstand, $funktionrename, $link1, $link2, $link3,$table5;
					}

Also Danke für die Hilfe von euch

Damit kann das hier geschlossen werden
 
Zurück