Jump to content

php breaking class


farahZ

Recommended Posts

i guess the problem with this code is the opening of php with html ..  its giving an error when executing
i double checked the opening of tags and its all closing 
 

 

Parse error: syntax error, unexpected end of file

 

<?php
 
//session_start();
 
if (isset($_POST['Go']))
{
  // check if an option has been selected
  if (empty($_POST['dates']))
  {
    echo 'You need to select some date!!'; 
  }
  else
  {
 
$con=mysqli_connect("localhost","root","","inshapewebsite");
 
   if (mysqli_connect_errno($con))
   {
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
    } 
 
     else
    {
    ?>
    <table width="800" border="3">
      <tr>
    <th bgcolor="#77eb8a" height="25" scope="col">Meal</th>
      <th bgcolor="#77eb8a" scope="col">Calories</th>
      </tr>
 
      <?
      $date =$_POST['dates'];
     $sql="SELECT fe.DayTime, SUM(f.Calories) as Calories 
     FROM fooddiary fe
     INNER JOIN food f USING (Food)
      WHERE fe.ID= 111 And fe.Date='$date'
      GROUP BY fe.DayTime";
     $result = mysqli_query($con, $sql) or die(mysqli_error());
 
    while ($row =  mysqli_fetch_array($result)) {
    ?>
     <tr>
    <td><?echo $row['DayTime'];?></td>
    <td><?echo $row['Calories'];?></td>
     </tr>  
    </table>
     <?
       }
       mysqli_close($con);
    }
    
}
?>
 
Link to comment
https://forums.phpfreaks.com/topic/278109-php-breaking-class/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.