Jump to content

php breaking class


Go to solution Solved by jazzman1,

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);
    }
    
}
?>
 
Edited by farahZ
Link to comment
https://forums.phpfreaks.com/topic/278109-php-breaking-class/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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