farahZ Posted May 17, 2013 Share Posted May 17, 2013 (edited) 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); } } ?> Edited May 17, 2013 by farahZ Quote 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. Quote 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 Quote 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 (edited) Aside, don't mess up the full and short php opening tags. Edited May 17, 2013 by jazzman1 Quote 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 (edited) how can fix the tags..i need to put some php in my html table Edited May 17, 2013 by farahZ Quote Link to comment https://forums.phpfreaks.com/topic/278109-php-breaking-class/#findComment-1430729 Share on other sites More sharing options...
Solution jazzman1 Posted May 17, 2013 Solution Share Posted May 17, 2013 Google "how to html and php" or something similar. Every "<?" tags in your scripts must be "<?php". Quote Link to comment https://forums.phpfreaks.com/topic/278109-php-breaking-class/#findComment-1430732 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.