Click here to Skip to main content
14,735,205 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<?php
@ob_start();
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial=scale=1" />
<title>STUDENT QUERIES COMPLAINTS</title>
<?php include('css_files.php'); ?>
</head>

<body>

<?php 
include('db.php');
include('stu_header.php'); 
if(isset($_SESSION['roll_no'])){ 
$roll_no = $_SESSION['roll_no'];
	$query = $db->query("SELECT * FROM `student_register` WHERE roll_no='$roll_no'") or die(mysqli_error());
	$row = mysqli_fetch_assoc($query);
	$branch = $row['branch'];
	$sem = $row['semister'];
?>
<!-- Start Content -->
<div class="sub_header_bg">
    QUERIES/COMPLAINTS
</div>	
<div class="strip" align="right">
    <a href="faculty_dashboard.php">Home</a>  <span style="color:#FFF;" class="fa fa-angle-right"></span>  <a href="">QUERIES/COMPLAINTS</a>
</div>
	<!-- Start Section 1 -->
 		  
		<div class="row m40_0">
        <div class="contact_form_text" style="margin-top:20px;">VIEW QUERIES/COMPLAINTS</div>
        <div align="center"><img src="images/shadow.png" class="img img-responsive" /></div>
        <?php
			if(isset($_GET['del'])){ ?>
                <div class="col-sm-12">
                	<div class="alert alert-danger" role="alert">
                    	Success! Reference Books has been deleted successfully!
                    </div>
                </div>	
		<?php }?>
        <div class="clearfix"></div>
        <div style="overflow-x:scroll">
        <table class="table table-bordered table-responsive table-bg" id="pages">
                          <thead>
                            <tr align="center">
                                <th class="text-center">S.No.</th>
                                <th class="text-center">Roll Number</th>
                                <th class="text-center">Qualification</th>
                                <th class="text-center">Stream</th>
                                <th class="text-center">Semester</th>
                                <th class="text-center">            Query               </th>
                                <th class="text-center">            Solution               </th>
                                <th class="text-center">Uploded By</th>
                            </tr>
              </thead>
                <tbody>
               <?php 
               if(isset($_POST['h']))
               {
                   $con=mysqli_connect('localhost','root','',"college_management_system");
                   
               $result = $db->query($con,"select 'id','roll_no',  'qualification','stream', 'semester','query','solution','uploaded_by'  WHERE 1 ");
               if($result->num_rows>0)
               {?>
               <?php
               $id = 1;
                while($row=mysqli_fetch_array($result)) 
                {
                    ?>
                    <?php
					//print_r($row); die;
                    echo "<tr align='center'>";
                    echo "<td align='center'>".$id."</td>";
					 echo "<td align='center'>".$row['roll_no']."</td>";
					echo "<td align='center'>".$row['qualification']."</td>";
					echo "<td align='center'>".$row['stream']."</td>";
                    echo "<td align='center'>".$row['semester']."</td>";
					echo "<td align='center'>".$row['query']."</td>";
					echo "<td align='center'>".$row['solution']."</td>";
					echo "<td align='center'>".$row['uploaded_by']."</td>";
                    echo "</tr>";
                    ?>
                    <?php
                    $id++;
                } 
                ?>
            </tbody>
        </table>
    </div>
  </div>
    
	<!-- End Section 1 -->
    
<!-- End Content -->
<?php 
include('footer.php');
include('js_files.php');
}else{
	header("location:index.php?suc=suc");
	}
?>
</body>
</html>


What I have tried:

db.php
<?php
error_reporting(0);
$db = new mysqli('localhost', 'root', '', 'college_management_system');
if($db->connect_errno){
	die('Sorry Database not connected !!!');
}
?>
Posted
Updated 8-Mar-20 22:16pm

1 solution

You have six open curly brackets, and only four close curly brackets: the numbers must match or the system doesn't understand what you are trying to do. and you will get an "unexpected end of file" error.

I'd strongly suggest that you make that one block of PHP code rather than scattering it across multiple blocks - it'll make it a load easier to read...
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900