I cannot find the reason what is causing an error when I run my PHP program. The error is :
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\focusreport.php on line 185
I checked all the ‘{’ and ‘}’ and all seems to be correct. Also the ‘;’. Can you check and see what I am missing. The program is listed below:
[php]
'; $month = date('n'); $year = date('Y'); $lyear = ( date('Y') - 1 ); echo $month. '
'; echo $year. '
'; echo $lyear. '
'; $db_host = "localhost"; $db_username = "John"; $db_pass = "****"; $db_name = "awm"; $mysqli = new mysqli($db_host, $db_username, $db_pass, $db_name); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } echo "Database connected". '
'; if ($month == 1) { JanTY(); } elseif ($month == 2) { FebTY(); } elseif ($month == 3) { MarTY(); } elseif ($month == 4) { AprTY(); } elseif ($month == 5) { MayTY(); } elseif ($month == 6) { echo "June". '
'; JunTY(); } elseif ($month == 7) { echo "July". '
'; JulTY(); } elseif ($month == 8) { AugTY(); } elseif ($month == 9) { SepTY(); } elseif ($month == 10) { OctTY(); } elseif ($month == 11) { NovTY(); } elseif ($month == 12) { DecTY(); } } function JanTY() { } function FebTY() { } function MarTY() { } function AprTY() { } function MayTY() { } function JunTY() { //$JunTY = $mysqli->query("SELECT SUM(`CasesShip`) FROM sales2014 WHERE Cust_Code == $cust && // (Date >= 06/01/$year && <= 06/31/$year)); //$result = $JunTY; //echo $result; // $result = $mysqli->query("SELECT Name FROM City LIMIT 10")) // printf("Select returned %d rows.\n", $result->num_rows); } function JulTY() { $JulyTY = $mysqli->query("SELECT SUM(`CasesShip`) FROM sales2014 WHERE Cust_Code == $cust && (Date >= 07/01/$year && <= 07/31/$year)); $JulyTY->data_seek(0); while ($row = $JulyTY->fetch assoc()) { echo 'Total Cases: ' . $JulyTY->num_rows; } $JulyTY->free(); } function AugTY() { } function SepTY() { } function OctTY() { } function NovTY() { } function DecTY() { $result = 'The FocusList file shows as '.$this->cust.' and '.$this->vend; return $result; } } /** * DetailThree * * Three Month Detail Report * */ function DetailThree() { echo 'In DetailThree function'; $result = 'The Detail FocusList file shows as '.$this->cust.' and '.$this->vend; return $result; } /** * SumSix * * Six Month Summary Report * */ function SumSix() { echo 'In SumSix function'; $result = 'The Six Summary FocusList file shows as '.$this->cust.' and '.$this->vend; return $result; } /** * DetailSix * * Six Month Detail Report * */ function DetailSix() { echo 'In DetailSix function'; $result = 'The Six Detail FocusList file shows as '.$this->cust.' and '.$this->vend; return $result; } ?>
[/php]
OpzMaster: Encased the PHP code in the PHP code formatter for better viewing.