Slip no. 9. Consider the following entities and their relationship.
Student ( stud_id, name, class)
Competition(c_no,c_name, type)
a) Relationship between student and competition In many-many with attributes rank and year.
b) Create a RDB in 3NF for above and solve the following.
c) Using above database write a script in PHP to accept a competition from user and display information of student who has secured 1st rank in that competition.
HTML file :
<form action=slip9_2.php>
Enter Compitition Name :<input type=text name=a id=a><br>
<input type=submit value="DISPLAY" >

PHP file :
$con_string="host=localhost dbname=bcs_slips port=5432  user=postgres password=nrc";

echo $a;
echo "</br>";
$q="select student.stud_id,sname,class from student,competition,stud_copm  where cnme='$a' and student.stud_id=stud_copm.stud_id and competition.c_no=stud_copm.c_no;";
$rs=pg_query($con,$q) or die("Cannot Execute query");
echo "$row[0] $row[1] $row[2]\n</br>";


No comments:

Post a comment

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