TY_BCA_AWT_SLIP 13_2



1    13. 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.


Html file :

<html>
<body>

<form action="slip_13.php" method="get">
Enter the name of competition  :  <input type=text name=cname><br>
<input type=submit value=SUBMIT>
</form>
</body>
<html>

Php file :

<?php
            $c_name   =   $_GET['cname'];

            $con   =   mysql_connect("localhost","root","");
            $d   =   mysql_select_db("bca_programs",$con);
            $q   =   mysql_query("select student_slip_13.stud_id,stud_name,stud_class from student_slip_13,compitition_slip_13,sc_slip_13 where student_slip_13.stud_id=sc_slip_13.stud_id and sc_slip_13.c_no=compitition_slip_13.c_no and c_name='$c_name' and rank=1");

            echo "<table>";
            echo "<tr><td>Student Id   |</td><td>Student Name   |</td><td>Student Class</td></tr>";
           
            while($row   =   mysql_fetch_array($q))
            {
                        echo "<tr><td>".$row[0]."</td><td>".$row[1]."</td><td>".$row[2]."</td></tr>";
            }
           
            echo "</table>";

            mysql_close();

?>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.