php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2010

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 20.01.2010, 11:57  
Neuer Benutzer
 
Registriert seit: 19.01.2010
Beiträge: 1
PHP-Kenntnisse:
Anfänger
SDroon befindet sich auf einem aufstrebenden Ast
Standard Parse error: syntax error, unexpected $end in C:\xampp\htdocs\.php on line 278

Hallo Zusammen!

Ich habe ein PHP-Script mit folgenden Code:

PHP-Code:
<?php
        
        
if(isset($_POST['cmbPeriod']))
        {
            include(
'inc/conn.inc');
        
            
            
$period $_POST['cmbPeriod'] ;
            
            if(
$period == 0
            {
            

                
$countQuery "select * from surveyt where DATE_SUB( CURDATE( ) , INTERVAL 7 DAY ) <= idate";
                
$rs mysql_query($countQuery);
                
$totalVote mysql_num_rows($rs);
                
                
                
$countQuery1 "select * from surveyt where ans = 1 and DATE_SUB( CURDATE( ) , INTERVAL 7 DAY ) <= idate";
                
$rs1 mysql_query($countQuery1);
                
$totalVote1 mysql_num_rows($rs1);
                
                
$countQuery2 "select * from surveyt where ans = 2 and DATE_SUB( CURDATE( ) , INTERVAL 7 DAY ) <= idate";
                
$rs2 mysql_query($countQuery2);
                
$totalVote2 mysql_num_rows($rs2);
                
                
$countQuery3 "select * from surveyt where ans = 3 and DATE_SUB( CURDATE( ) , INTERVAL 7 DAY ) <= idate";
                
$rs3 mysql_query($countQuery3);
                
$totalVote3 mysql_num_rows($rs3);
                
                
$commentQuery1 "select  comment1 from surveyt where ans = 1 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 7 DAY ) <= idate";
                
                  
$commentQuery2 "select  comment1 from surveyt where ans = 2 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 7 DAY ) <= idate";
                
                
$commentQuery3 "select comment1 from surveyt where ans = 3 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 7 DAY ) <= idate";
            }
            
            if(
$period == 1
            {
            

                
$countQuery "select * from surveyt where DATE_SUB( CURDATE( ) , INTERVAL 14 DAY ) <= idate";
                
$rs mysql_query($countQuery);
                
$totalVote mysql_num_rows($rs);
                
                
                
$countQuery1 "select * from surveyt where ans = 1 and DATE_SUB( CURDATE( ) , INTERVAL 14 DAY ) <= idate";
                
$rs1 mysql_query($countQuery1);
                
$totalVote1 mysql_num_rows($rs1);
                
                
$countQuery2 "select * from surveyt where ans = 2 and DATE_SUB( CURDATE( ) , INTERVAL 14 DAY ) <= idate";
                
$rs2 mysql_query($countQuery2);
                
$totalVote2 mysql_num_rows($rs2);
                
                
$countQuery3 "select * from surveyt where ans = 3 and DATE_SUB( CURDATE( ) , INTERVAL 14 DAY ) <= idate";
                
$rs3 mysql_query($countQuery3);
                
$totalVote3 mysql_num_rows($rs3);
                
                
$commentQuery1 "select  comment1 from surveyt where ans = 1 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 14 DAY ) <= idate";
                
                  
$commentQuery2 "select  comment1 from surveyt where ans = 2 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 14 DAY ) <= idate";
                
                
$commentQuery3 "select comment1 from surveyt where ans = 3 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 14 DAY ) <= idate";
            }
            
            if (
$period == 2
            {
            

                
$countQuery "select * from surveyt where DATE_SUB( CURDATE( ) , INTERVAL 30 DAY ) <= idate";
                
$rs mysql_query($countQuery);
                
$totalVote mysql_num_rows($rs);
                
                
                
$countQuery1 "select * from surveyt where ans = 1 and DATE_SUB( CURDATE( ) , INTERVAL 30 DAY ) <= idate";
                
$rs1 mysql_query($countQuery1);
                
$totalVote1 mysql_num_rows($rs1);
                
                
$countQuery2 "select * from surveyt where ans = 2 and DATE_SUB( CURDATE( ) , INTERVAL 30 DAY ) <= idate";
                
$rs2 mysql_query($countQuery2);
                
$totalVote2 mysql_num_rows($rs2);
                
                
$countQuery3 "select * from surveyt where ans = 3 and DATE_SUB( CURDATE( ) , INTERVAL 30 DAY ) <= idate";
                
$rs3 mysql_query($countQuery3);
                
$totalVote3 mysql_num_rows($rs3);
                
                
$commentQuery1 "select  comment1 from surveyt where ans = 1 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 30 DAY ) <= idate";
                
                  
$commentQuery2 "select  comment1 from surveyt where ans = 2 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 30 DAY ) <= idate";
                
                
$commentQuery3 "select comment1 from surveyt where ans = 3 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 30 DAY ) <= idate";
            }
            
            if(
$period == 3
            {
            

                
$countQuery "select * from surveyt where DATE_SUB( CURDATE( ) , INTERVAL 60 DAY ) <= idate";
                
$rs mysql_query($countQuery);
                
$totalVote mysql_num_rows($rs);
                
                
                
$countQuery1 "select * from surveyt where ans = 1 and DATE_SUB( CURDATE( ) , INTERVAL 60 DAY ) <= idate";
                
$rs1 mysql_query($countQuery1);
                
$totalVote1 mysql_num_rows($rs1);
                
                
$countQuery2 "select * from surveyt where ans = 2 and DATE_SUB( CURDATE( ) , INTERVAL 60 DAY ) <= idate";
                
$rs2 mysql_query($countQuery2);
                
$totalVote2 mysql_num_rows($rs2);
                
                
$countQuery3 "select * from surveyt where ans = 3 and DATE_SUB( CURDATE( ) , INTERVAL 60 DAY ) <= idate";
                
$rs3 mysql_query($countQuery3);
                
$totalVote3 mysql_num_rows($rs3);
                
                
$commentQuery1 "select  comment1 from surveyt where ans = 1 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 60 DAY ) <= idate";
                
                  
$commentQuery2 "select  comment1 from surveyt where ans = 2 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 60 DAY ) <= idate";
                
                
$commentQuery3 "select comment1 from surveyt where ans = 3 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 60 DAY ) <= idate";
            }
            
            if(
$period == 4
            {
            

                
$countQuery "select * from surveyt where DATE_SUB( CURDATE( ) , INTERVAL 90 DAY ) <= idate";
                
$rs mysql_query($countQuery);
                
$totalVote mysql_num_rows($rs);
                
                
                
$countQuery1 "select * from surveyt where ans = 1 and DATE_SUB( CURDATE( ) , INTERVAL 90 DAY ) <= idate";
                
$rs1 mysql_query($countQuery1);
                
$totalVote1 mysql_num_rows($rs1);
                
                
$countQuery2 "select * from surveyt where ans = 2 and DATE_SUB( CURDATE( ) , INTERVAL 90 DAY ) <= idate";
                
$rs2 mysql_query($countQuery2);
                
$totalVote2 mysql_num_rows($rs2);
                
                
$countQuery3 "select * from surveyt where ans = 3 and DATE_SUB( CURDATE( ) , INTERVAL 90 DAY ) <= idate";
                
$rs3 mysql_query($countQuery3);
                
$totalVote3 mysql_num_rows($rs3);
                
                
$commentQuery1 "select  comment1 from surveyt where ans = 1 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 90 DAY ) <= idate";
                
                  
$commentQuery2 "select  comment1 from surveyt where ans = 2 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 90 DAY ) <= idate";
                
                
$commentQuery3 "select comment1 from surveyt where ans = 3 and comment1 <> '' and DATE_SUB( CURDATE( ) ,                                  INTERVAL 90 DAY ) <= idate";
            }

        }
        
        
?>
<html>
<head>

</head>

<body>
<form id="frmReport" name="frmReport" action="surveyReport.php" method="post">
<div align="center"><strong>Survey Report</strong></div>

<p align="center">
  <label>
  <select name="cmbPeriod" id="cmbPeriod">
    <option value="-1">Select Period</option>
    <option value="0">Last week</option>
    <option value="1">Last 2 week</option>
    <option value="2">Last month</option>
    <option value="3">Last 2 month</option>
    <option value="4">Last 3 month</option>
      </select> 
  </label>
  &nbsp;&nbsp;
  <label>
  <input type="submit" name="button" id="button" value="Go" />
  </label>
</p>
<table width="539" border="1" cellspacing="0" cellpadding="0" align="center">
     <?php 
            
if(isset($_POST['cmbPeriod']) and $period >= 0)
            {
?>
  <tr>
      <td colspan="3" align="center">
            <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="543" height="250" id="line_graph" align="middle">
            <param name="allowScriptAccess" value="sameDomain" />
            <param name="FlashVars" value="period_id=<? echo $_POST['cmbPeriod']; ?>" />
            <param name="movie" value="line_graph.swf" /><param name="quality" value="high" /><param name="bgcolor" value="#e6e6e6" /><embed src="line_graph.swf" FlashVars="period_id=<? echo $_POST['cmbPeriod']; ?>" quality="high" bgcolor="#e6e6e6" width="543" height="250" name="line_graph" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
    </td>
  </tr>
      
            <?}
     
?>        
        
  <tr>
    <td width="178" valign="top"><table width="173" border="0" >
      <tr>
        <td width="163"><div align="center"><strong>Image 1</strong></div></td>
      </tr>
      <tr>
        <td><img src="http://www.php.de/images/1.jpg" height="163" /></td>
      </tr>
      <tr>
        <td><strong>Vote :  <?php if(isset($_POST['cmbPeriod']) and $period>0)
                                    { echo  
round($totalVote1/$totalVote 100 ,2) . "%"  ;
                            }
?> 
        </strong></td>
      </tr>
      <?php
              
if(isset($_POST['cmbPeriod']) and $period>0)
            {
                
                
$fetchComment1 mysql_query($commentQuery1);
    
                echo  
"<tr><td><strong>Comment :</strong></td></tr> ";
    
                while(
$rec1=mysql_fetch_row($fetchComment1))
                {
                  echo  
"<tr><td>".$rec1[0]."</td></tr> ";
                }
            }
      
?>
    </table></td>
    <td width="173" valign="top"><table width="172" border="0">
      <tr>
        <td width="162"><div align="center"><strong>Image 2</strong></div></td>
      </tr>
      <tr>
        <td><img src="http://www.php.de/images/2.jpg" height="163" /></td>
      </tr>
      <tr>
        <td><strong>Vote : <?php if(isset($_POST['cmbPeriod']) and $period>0) { echo round($totalVote2/$totalVote 100,2) . "%" ; } ?> </strong></td>
      </tr>
          <?php
              
if(isset($_POST['cmbPeriod']) and $period>0)
            {
                
                
$fetchComment2 mysql_query($commentQuery2);
                
                echo  
"<tr><td><strong>Comment :</strong></td></tr> ";
    
                while(
$rec=mysql_fetch_row($fetchComment2))
                {
                  echo  
"<tr><td>"$rec[0]."</td></tr> ";
                }
            }
      
?>
    </table></td>
    <td width="200" valign="top"><table width="171" border="0">
      <tr>
        <td width="161"><div align="center"><strong>Image 3</strong></div></td>
      </tr>
      <tr>
        <td><img src="http://www.php.de/images/3.jpg" height="163" /></td>
      </tr>
      <tr>
        <td><strong>Vote : <?php if(isset($_POST['cmbPeriod']) and $period>0) { echo round($totalVote3/$totalVote 100,2) ."%" ; }?> </strong></td>
      </tr>
          <?php
              
if(isset($_POST['cmbPeriod']) and $period>0)
            {
                
                
$fetchComment3 mysql_query($commentQuery3);
                
                echo  
"<tr><td><strong>Comment :</strong></td></tr> ";
    
                while(
$rec=mysql_fetch_row($fetchComment3))
                {
                  echo  
"<tr><td>"$rec[0] ." </td></tr> ";
                }
            }
      
?>
    </table></td>
  </tr>
</table>
</form>
</body>
</html>
Beim Ausführen bekomme ich dann die folgende Fehlermeldung:
Parse error: syntax error, unexpected $end in C:\xampp\htdocs\surveyReport.php on line 278.
Zeile 278 ist in diesem Fall die Zeile "</html>", wobei ich nicht weiß was daran falsch sein könnte. Weiß jemand, wo das Problem liegt? Danke für jede Hilfe.
SDroon ist offline  
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 20.01.2010, 12:01  
da schreibt der ElePHPant
 
Benutzerbild von Flor1an
 
Registriert seit: 18.06.2008
Beiträge: 8.903
PHP-Kenntnisse:
Fortgeschritten
Flor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer AnblickFlor1an ist ein wunderbarer Anblick
Standard

Fehlt wahrscheinlich ne Klammer.

Deine Einrückung ist schlecht, rück doch mal deinen PHP Code richtig ein dann kannst du viel Besser erkennen wo dein Problem liegen könnte.
Flor1an ist offline  
Alt 20.01.2010, 12:02  
bandit600
Gast
 
Beiträge: n/a
Standard

Da fehlt garantiert eine schließende Klammer.
 
Alt 20.01.2010, 12:32  
Erfahrener Benutzer
 
Registriert seit: 21.12.2004
Beiträge: 5.240
PHP-Kenntnisse:
Fortgeschritten
mepeisen ist ein wunderbarer Anblickmepeisen ist ein wunderbarer Anblickmepeisen ist ein wunderbarer Anblickmepeisen ist ein wunderbarer Anblickmepeisen ist ein wunderbarer Anblickmepeisen ist ein wunderbarer Anblickmepeisen ist ein wunderbarer Anblick
mepeisen eine Nachricht über ICQ schicken mepeisen eine Nachricht über Skype™ schicken
Standard

Da fehlen sogar mindestens 2 schließende Klammern, wenn ich es mal so überfliege. Davon abgesehen: Lerne im Tutorial deines Vertrauens, was switch ist.
__________________
www.php-maven.org PHP und Maven vereint: Build/Deploy/Produktion/Konfiguration, Projekt Management, CI, PHPUnit, zahlreiche Frameworks
Twitter @ https://twitter.com/#!/mepeisen und Facebook @ http://t.co/DZnKSUih
mepeisen ist offline  
Alt 20.01.2010, 13:22  
Erfahrener Benutzer
 
Benutzerbild von Dark Guardian
 
Registriert seit: 10.10.2009
Beiträge: 2.637
PHP-Kenntnisse:
Fortgeschritten
Dark Guardian ist jedem bekanntDark Guardian ist jedem bekanntDark Guardian ist jedem bekanntDark Guardian ist jedem bekanntDark Guardian ist jedem bekanntDark Guardian ist jedem bekannt
Standard

Ich kann das Script so wie es hier gepostet ist ohne parse Error ausführen. Zend motzt auch nicht wegen der Klammersetzung.

Bitte poste "den richtigen" falschen Code.
__________________
"Alles im Universum funktioniert, wenn du nur weißt wie du es anwenden musst".
Dark Guardian ist offline  
Alt 20.01.2010, 18:47  
SynCore-Systems
Gast
 
Beiträge: n/a
Standard

So wie ich das auf den ersten Blick beurteilen kann liegt es an den php.ini-Einstellungen - zumindest wenn es bei dem Einen klappt und woanders nicht.
Weiß jetzt nicht wie weit du die Versionsgeschichte von PHP 5 kennst, allerdings habe ich mitbekommen, dass short_open_tags (zumindest bei der neuen XAMPP-Version) neuerdings standardmäßig auf OFF gestellt wird.
Um das zu testen also einfach mal alle <? durch <?php ersetzen und wenns funktioniert hat bitte Bescheid geben .
 
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Parse error: syntax error, unexpected $end Thoresus PHP Tipps 2009 24 27.07.2009 23:12
[Erledigt] PHP in Console lithium Server, Hosting und Workstations 16 25.06.2009 00:52
[Erledigt] Parse error: syntax error, unexpected $end in philomene PHP Tipps 2009 8 22.05.2009 12:21
Erneut Vorstellung meiner Seite. litterauspirna Off-Topic Diskussionen 11 16.02.2009 19:17
php datei löschen djscaleo PHP Tipps 2008 21 14.11.2008 15:47
[Erledigt] PHP -&gt; Ordner anlegen der sich auch beschreiben lässt?! Nightuser PHP Tipps 2008 13 30.06.2008 23:51
Suche Tipps für Persormance-Steigerung (Geld für Nützliches) Beitragsarchiv 18 16.08.2005 10:57
Suche Programmierer, Designer, Schreiber... blinkster.de Beitragsarchiv 76 14.08.2005 18:31
parse error on line 4 PHP Tipps 2005-2 5 16.07.2005 11:22
update auf php 5.0.4 robo47 Server, Hosting und Workstations 6 10.04.2005 19:00
ShowIt_V1.8.14 PHP Tipps 2005 1 23.03.2005 19:13
Parse error: unexpected $end ... on line xy PHP Tipps 2004 2 18.09.2004 13:18
Script Problem: parse error unexpected $end PHP Tipps 2004 5 02.08.2004 13:25

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
parse error: syntax error, unexpected $end in xampp, xampp parse error: syntax error, unexpected $end in, xampp parse error: syntax error, unexpected $end, parse error: syntax error, unexpected $end, unexpected error php xampp, parse error: syntax error, unexpected $end in c:\\xampp\\htdocs, parse error: syntax error, unexpected $end in c:\\xampp\\xampp\\htdocs, parse error syntax error unexpected end xampp, php online parser, parse error: syntax error, unexpected $end xampp, parse error: syntax error, unexpected $end in c:\\xampp\\htdocs\\gh\\import.php on line, unexpected $end php5, parse error: syntax error, unexpected $end in c:\\xampp\\htdocs\\meine seite\\startseite.php on line 60, php.ini syntax error, unexpected \'=, parse error: syntax error, unexpected $end in c:/xampp/xampp/htdocs/, error parsing input day, mysql_query interval, xampp parse error: syntax error, mysql_num_rows parse error, xampp parse error parse error, unexpected $end

Alle Zeitangaben in WEZ +2. Es ist jetzt 20:59 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum