farahZ Posted May 17, 2013 Share Posted May 17, 2013 i guess the problem with this code is the opening of php with html .. its giving an error when executingi 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 More sharing options...
requinix Posted May 17, 2013 Share Posted May 17, 2013 if (isset($_POST['Go'])) {That's never closed. Link to comment https://forums.phpfreaks.com/topic/278109-php-breaking-class/#findComment-1430721 Share on other sites More sharing options...
farahZ Posted May 17, 2013 Author Share Posted May 17, 2013 yes it's.. i missed copying one brace Link to comment https://forums.phpfreaks.com/topic/278109-php-breaking-class/#findComment-1430727 Share on other sites More sharing options...
jazzman1 Posted May 17, 2013 Share Posted May 17, 2013 Aside, don't mess up the full and short php opening tags. Link to comment https://forums.phpfreaks.com/topic/278109-php-breaking-class/#findComment-1430728 Share on other sites More sharing options...
farahZ Posted May 17, 2013 Author Share Posted May 17, 2013 how can fix the tags..i need to put some php in my html table Link to comment https://forums.phpfreaks.com/topic/278109-php-breaking-class/#findComment-1430729 Share on other sites More sharing options...
jazzman1 Posted May 17, 2013 Share Posted May 17, 2013 Google "how to html and php" or something similar. Every "<?" tags in your scripts must be "<?php". Link to comment https://forums.phpfreaks.com/topic/278109-php-breaking-class/#findComment-1430732 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.