Slip no. 13. Consider the following entities and their relationship.
Doctor ( doc_no, dname, address, city, area)
Hospital (hosp_no, hname, hcity)
Doctor-Hospital related with many-one relationship.
Create a RDB in 3NF for above and solve the following.
Using above database write a script in PHP to print the Doctor visiting to the hospital in tabular format. Accept hospital name from user[ Use PostgreeSQL]
HTML file :
<form action=slip13_2.php>
Enter Hospital 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";

$con = pg_connect($con_string);

$a = $_GET['a'];
echo $a;
echo "</br>";
$q = "select dname from doctor,hospital where hname='$a' and hospital.hosp_no = doctor.hosp_no;";

$rs = pg_query($con,$q) ;
echo "in";
echo "$row[0]\n</br>";

No comments:

Post a comment

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