Considerer the following entities and their relationships Student (Stud_id,name,class) Competition (c_no,c_name,type) Relationship between student and competition is many-many with attribute rank and year. Create a RDB in 3NF for the above and solve the following. Using above database write a script in PHP to accept a competition name from user and display information of student who has secured 1st rank in that competition

StudCom.html
<html>
<body>
<form method="get" action="studcomp.php">
<fieldset>
            <legend>Enter Competition Name :</legend><br>
<input type="text" name="cnm"><br><br>
</fieldset>
<div align="center">
<input type="submit" value="Show Result">
</div>
</form>
</body>
</html>
StudCom.php
<?php
        $cnames=$_GET['cnm'];
                       
                        $hn="localhost";
                        $un="root";
                        $pass="";
                        $db="students";
                       
                        $link=mysqli_connect($hn,$un,$pass,$db);
            if(!$link)
            {
                        die('Connection Failed:'.mysqli_error());
            }
            //$sql="SELECT * FROM student WHERE CNo IN (SELECT CNo FROM competition WHERE CName = '".$cname."')";
            $sql="select * from student,competition,studcomp where student.Sid=studcomp.Sid and competition.CNo=studcomp.CNo and rank='1' and CName='".$cnames."'";
            $res=mysqli_query($link,$sql);          
                       
            if(mysqli_num_rows($res)>0)
            {
                        while($row=mysqli_fetch_assoc($res))
         {
                                    echo"Stud No : ".$row['Sid']."<br>"."  Name  : ".$row['SName']."<br>";
                                    echo"Class :  ".$row['SClass']."<br>";
                                    echo"--------------------------"."<br>";
                        }
            }
            else
            {
                        echo"error";
            }
            mysqli_close($link);

?>