Consider the following relational database: Project (P_Group_No, Project_Title) Student (Seat no, Name, Class, P_Group_No) Write a PHP script to accept project title and display list of students those who are working in a particular project.

Project.html

<html>
<body>
<form method=get action="Project.php">
Enter Project Tittle : <input type=text name="pname"><br><br>
<input type=submit value="Display">
</form>
</body>
</html>

Project.php

<?php
         $pname=$_GET['pname'];
mysql_connect("localhost","root","") or die(mysql_error());
mysql_select_db("userpass") or die(mysql_error());
         $result=mysql_query("SELECT * FROM student WHERE pgno IN (SELECT pgno FROM project WHERE ptittle = '".$pname."')");
while($row=mysql_fetch_array($result))
         {
echo"Seat No = ".$row['sno']."  Name  = ".$row['name'];
echo"  Class =  ".$row['class']." Proj. Group No. =  ".$row['pgno']."<br>";
        }
?>

Comments

Popular posts from this blog

Create an XML file which gives details of books available in “ABC Bookstore” from following categories. 1)      Technical 2)      Cooking 3)      Yoga And elements in each category are in the following format.     …….     …….     ……. Save the file as “Book.xml” Create an application that reads “Book.xml” file into simple XML object. Display attributes and elements. (Hint:- Use simple_xml_load_file() function). 

Write a PHP program to create a simple calculator that can accept two numbers and perform operations like add, subtract, multiplication and divide (using Self Processing form)

Write a script to solve following questions(use “Book.xml” file) A:- Create a Dom document object and load this xml file. B:- Get the output of this document to the browser. C:- Save this [.xml] document in another format that i.e. in [.doc]. D:- Write a xml program to print the names of the books available in “Book.xml” file.