-1

I'm trying to fetch data from more then two tables but I'm facing syntax errors of (T_ENCAPSED_AND_WHITESPACE). I don't know why it throws these errors. Is my method incorrect or have I made any syntax errors? Please help me to figure out this stuff.

<?php
$sql = "SELECT e.Exam_Name,e.Start_date,c.Standard,c.division,c.RollNo,r.Subject_Name,r.Marks,r.OutOFF 
     FROM e exam, c class, r result
     where c.Class_ID = e.Class_ID
     AND c.Student_ID = r.Student_ID;
        if($result = mysqli_query($con,$sql))
          {
            while($row1 = mysqli_fetch_array($result))
            {   
        ?>
        <html>
        <head></head>
        <body>
        <table>
        <tr>
            <td><?php echo $row1['Exam_Name'];?></td>
            <td><?php echo $row1['Start_date'];?></td>
            <td><?php echo $row1['Standard'];?></td>
            <td><?php echo $row1['division'];?></td>
            <td><?php echo $row1['RollNo'];?></td>
            <td><?php echo $row1['Subject_Name'];?></td>
            <td><?php echo $row1['Marks'];?></td>
            <td><?php echo $row1['OutOFF'];?></td>
        </tr>   
        </table>    
            </body>             
            </html>
            <?php
            }
          }

?>

fourpastmidnight
  • 4,032
  • 1
  • 35
  • 48
Rohit Pal
  • 11
  • 1
  • 5

1 Answers1

2

You forgot to close ". It must be :

 sql = "SELECT e.Exam_Name,e.Start_date,c.Standard,c.division,c.RollNo,r.Subject_Name,r.Marks,r.OutOFF 
 FROM e exam, c class, r result
 where c.Class_ID = e.Class_ID
 AND c.Student_ID = r.Student_ID";
Doruk Ayar
  • 334
  • 1
  • 4
  • 17
  • Ahh got it thank u for your valuable response but i still not getting result it showing nothing in my browser its showing blank – Rohit Pal Nov 16 '16 at 07:54
  • @RohitPal I don't know how to figure out that sorry – Doruk Ayar Nov 16 '16 at 08:26
  • i got what i did wrong in 'FROM e exam, c class, r' result is wrong method to assign when i give 'FROM exam e, class c, result r' this method is works thanks again @Doruk Ayar – Rohit Pal Nov 16 '16 at 12:43