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>
<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.