Parse Error

Bash, Shell, PHP, Python, Perl, CGI
Post Reply
anpa
Posts: 55
Joined: 2003-06-24 17:48
Location: lübeck
Contact:
 

Parse Error

Post by anpa »

Hallo...
Ich seh den Wald vor lauter Bäumen nicht..
Was ist hier Richtig:

for($x=0;$x<$loccount;$x++) {
...
}

und hier Falsch???

for($x=0;$x<$shocount;$x++) {
...
}

Bei der unteren for schleife bekomm ich diese Meldung:
Parse error: parse error, expecting `';'' in c:apachehtdocsincludesdatei.php on line 37
Und die line 37 ist die 2. for schleife... loccount und shocount sind beide 1.
Sowohl aus einer Datenbank die 1, als ein counter, und auch direkt mit $shocount=1. Nix geht!!! Gebe ich direkt 1 ein anstatt shocount gehts.
mit echo $shocount kommt auch 1 .
Ich weiss net mehr weiter....
Gruß
Angelo
wirsing
Posts: 604
Joined: 2002-11-20 21:32
Location: Vaihingen und Karlsruhe
 

Re: Parse Error

Post by wirsing »

Schon mal probiert, ob in der Zeile davor vielleicht ein Strichpunkt am Ende fehlt?
anpa
Posts: 55
Joined: 2003-06-24 17:48
Location: lübeck
Contact:
 

Re: Parse Error

Post by anpa »

Ja. Ist es leider nicht......
Es funktioniert ja wenn ich $shocount durch eine zahl ersetze....
raymatrix
Posts: 43
Joined: 2003-07-05 11:20
 

Re: Parse Error

Post by raymatrix »

liegen die Schleifen womöglich in ner Funktion und Du hast übersehen die var der 2. Schleife zu übergeben bzw global zu deklarieren ?

Sorry aber ne andere Erklärung hätte ich anhand Deiner Scriptauszüge auch nicht. . . .
anpa
Posts: 55
Joined: 2003-06-24 17:48
Location: lübeck
Contact:
 

Re: Parse Error

Post by anpa »

Ne eben nicht...
Ich habe vor beiden schleifen noch ein echo mit der variable.
und die tut er anzeigen...
Also sind die variablen doch ok oder nicht?

Das ist das mal ohne was rauszunehmen:

Code: Select all

echo "<tr><td>Location:</td><td><select size='1' name='locid'>";
$loccount=count($locationid);
echo "<tr><td colspan='2'>LocCount: $loccount</td></tr>";
for($x=0;$x<$loccount;$x++) {
	echo "<option value='$locationid[$x]'>$locationname[$x], $locationort[$x]</option>";
}
echo "</select></td></tr>";
//$shocount=count($shooterid); 
$shocount=1;
echo "<tr><td colspan='2'>ShoCount: $shocount </td></tr>";
echo "<tr><td>Shooter:</td><td><select size='1' name='shoid'>";

for($x=0;$x<$shocount;$x++) {
	echo "<option value='$shooterid[$x]'>$shootervorname[$x] $shootername[$x]</option>";
}
Das auskommentierte ist die eigentliche herkunft der variable. Er soll die Anzahl der Datensätze in dem Array ausgeben und die dann abarbeiten. Bei dem ersten gehts ja auch. Auch wenn ich von hand die zahl der arrays auf 1 setzte gehts nicht....
raymatrix
Posts: 43
Joined: 2003-07-05 11:20
 

Re: Parse Error

Post by raymatrix »

Also wenn ich Dein Script bei mir mal schnell ausführe klappt das einwandfrei. . .

Ich hab dann auch mal $shocount=1; auf 5 gesetzt und bekomm dann auch direkt ein 5 zeiliges dropdown....klar ohne Inhalt, aber es rennt.

Ich weis da jetzt auch nicht weiter. . .
anpa
Posts: 55
Joined: 2003-06-24 17:48
Location: lübeck
Contact:
 

Re: Parse Error

Post by anpa »

Bei mir nicht.. Ich könnte heulen.
Ich starte das auch mal alleine ohne den anderen murgs dabei.
Gleich sag ich s *g*
anpa
Posts: 55
Joined: 2003-06-24 17:48
Location: lübeck
Contact:
 

Re: Parse Error

Post by anpa »

Gleicher fehler...
Ich kann nicht mehr :)
Ist das vielleicht ein PHP Bug? Welche Version hast du?
raymatrix
Posts: 43
Joined: 2003-07-05 11:20
 

Re: Parse Error

Post by raymatrix »

Ich hab das grad mit dem Hyper genialen Freewaretool Namens: 'Symtec Development Studio' getestet und da ist die Vers. 5.0.0b1 mit drin.
hossa
Posts: 7
Joined: 2003-09-30 09:05
 

Re: Parse Error

Post by hossa »

hast du irgendwo weiter oben noch was auskommentiert? der scriptteil funktioniert soweit. das problem muss evtl. wo anders liegen (nicht geschlossene klammer oder ähnliches)
anpa
Posts: 55
Joined: 2003-06-24 17:48
Location: lübeck
Contact:
 

Re: Parse Error

Post by anpa »

Ich hab genau das scriptteil nochmal alleine getestet mit dem selben problem...
Poste mir mal bitte genau das script wie es bei dir läuft. will das bei mir nochma ausprobieren...
raymatrix
Posts: 43
Joined: 2003-07-05 11:20
 

Re: Parse Error

Post by raymatrix »

Code: Select all

<?php
	 $locationid = 5;
     
$loccount=$locationid; 
echo "<tr><td colspan='2'>LocCount: $loccount </td></tr>";
echo "<tr><td>Location:</td><td><select size='1' name='locid'>";  
for($x=0;$x<$loccount;$x++) { 
   echo "<option value='$locationid[$x]'>$locationname[$x] $locationort[$x]</option>"; 
} 
echo "</select></td></tr>"; 
//$shocount=count($shooterid); 
$shocount=5; 
echo "<tr><td colspan='2'>ShoCount: $shocount </td></tr>"; 
echo "<tr><td>Shooter:</td><td><select size='1' name='shoid'>"; 

for($x=0;$x<$shocount;$x++) { 
   echo "<option value='$shooterid[$x]'>$shootervorname[$x] $shootername[$x]</option>"; 
}
?>
hossa
Posts: 7
Joined: 2003-09-30 09:05
 

Re: Parse Error

Post by hossa »

folgendes script:

Code: Select all

<?
echo "<tr><td>Location:</td><td><select size='1' name='locid'>"; 
$loccount=count($locationid); 
echo "<tr><td colspan='2'>LocCount: $loccount</td></tr>"; 
for($x=0;$x<$loccount;$x++) { 
   echo "<option value='$locationid[$x]'>$locationname[$x], $locationort[$x]</option>"; 
} 
echo "</select></td></tr>"; 
$shocount=count($shooterid); 
//$shocount=1; 
echo "<tr><td colspan='2'>ShoCount: $shocount </td></tr>"; 
echo "<tr><td>Shooter:</td><td><select size='1' name='shoid'>"; 

for($x=0;$x<$shocount;$x++) { 
   echo "<option value='$shooterid[$x]'>$shootervorname[$x] $shootername[$x]</option>"; 
}
?>
gibt folgende ausgabe:

Code: Select all

<tr><td>Location:</td><td><select size='1' name='locid'><tr><td colspan='2'>LocCount: 0</td></tr></select></td></tr><tr><td colspan='2'>ShoCount: 0 </td></tr><tr><td>Shooter:</td><td><select size='1' name='shoid'>
anpa
Posts: 55
Joined: 2003-06-24 17:48
Location: lübeck
Contact:
 

Re: Parse Error

Post by anpa »

Ã?hm...
Nochmal ne ganz dumme frage....
Wenn ich ein Script nicht mit ?> abschliesse, kann es dann sein das es nicht korrekt funktioniert ??? :oops:
raymatrix
Posts: 43
Joined: 2003-07-05 11:20
 

Re: Parse Error

Post by raymatrix »

Jup
anpa
Posts: 55
Joined: 2003-06-24 17:48
Location: lübeck
Contact:
 

Re: Parse Error

Post by anpa »

Oh mann!!! :oops: :oops: :oops:
Nu helft ihr mir nie wieder....
Jetzt hab ich verschissen bei euch :lol:
So ein auch wirklich dummer fehler..
Aber das liegt bestimmt daran das man schon tagelang davor sitzt :)
(Also nicht an diesem problem, sondern allgemein am ganzen projekt)
Trotzdem vielen Dank euch allen!!!

Ps. Kann nicht einer den Thread löschen? Das is peinlich :oops:
raymatrix
Posts: 43
Joined: 2003-07-05 11:20
 

Re: Parse Error

Post by raymatrix »

Aua. . .

Aber auch sowas passiert :wink:
anpa
Posts: 55
Joined: 2003-06-24 17:48
Location: lübeck
Contact:
 

Re: Parse Error

Post by anpa »

JO das hab ich gemerkt...
Ich glaub ich geh ins bett ...
Gute Nacht *g*
wirsing
Posts: 604
Joined: 2002-11-20 21:32
Location: Vaihingen und Karlsruhe
 

Re: Parse Error

Post by wirsing »

Ã?hm - also ich schreibe öfter Scripte, bei denen ich nicht mit ?> abschließe. Wenn ich später noch Header senden will, kann es schließlich sein, dass ein (unabsichtlich) nachgefügter Zeilenumbruch bereits die Ausgabe startet.
Das funktioniert so immer - allerdings benutze ich auch <?php als Starttag.
Post Reply