Skvamsi Akella

Skvamsi Akella

  • NA
  • 37
  • 10.4k

please clarify my code and make it correct asap

Oct 21 2017 10:58 PM
 1. Search the patient form:(srp.jsp)
<html>
<body>
<center>
<marquee><h4>welcome to N</h4></marquee>
</center>
<center>
<h3 class="wrapper"><label>Filter your search </label> </h3>
</center>

<center>
<table border="0">
<form action="srp1.jsp" method="get">


<tr>
<td><h3>Patient Name:</h3></td> </div>
<td><input type="text" name="pnm" placeholder="enter your Patient Name" required></td>
</tr>



</table>
</center>
<br>
<center>
<tr><td><label>Search Patient</label></td></tr>
<td><input type="submit" value="search"></td>
</center>
</form>
<br>
</body>
</html> 
 
2. search the patient jdbc program
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.io.*"%>
<%@ page import ="java.sql.*" %>

<% Class.forName("com.mysql.jdbc.Driver"); %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
Connection connection = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/db", "root", "root");

Statement statement = connection.createStatement();

String PatientName = request.getParameter("pnm");

ResultSet rs =
//statement.executeQuery("select * from prg s,HealthRecords t where s.name=t.pnmt") ;
statement.executeQuery("select * from prg,healthRecords") ;

if(!rs.next()) {
out.println("Sorry, could not find that patient. ");
} else {
%>

<TABLE BORDER="1">

<tr>
<TH>Category</TH>
<TD> <%= rs.getString("ctgy") %> </TD>
</tr>
<tr>
<TH>Name</TH>
<TD> <%= rs.getString("name") %> </TD>
</tr>
<tr>
<TH>Age</TH>
<TD> <%= rs.getString("age") %> </TD>
</tr>
<tr>
<TH>Gender</TH>
<TD> <%= rs.getString("gender") %> </TD>
</tr>
<tr>
<TH>Profession</TH>
<TD> <%= rs.getString("profs") %> </TD>
</tr>
<tr>
<TH>Select File</TH>
<TD> <%= rs.getString("photo") %> </TD>
</tr>
<tr>
<TH>Phone</TH>
<TD> <%= rs.getString("mobile") %> </TD>
</tr>
<tr>
<TH>Email</TH>
<TD> <%= rs.getString("email") %> </TD>
</tr>
<tr>
<TH>HeartBeat</TH>
<TD> <%= rs.getString("HeartBeat") %> </TD>
</tr>
<tr>
<TH>Select Prescription</TH>
<TD> <%= rs.getString("prescription") %> </TD>
</tr>
<tr>
<TH>BloodPressure</TH>
<TD> <%= rs.getString("BP") %> </TD>
</tr>
<tr>
<TH>PastDiseases</TH>
<TD> <%= rs.getString("pastdiseases") %> </TD>
</tr>
</tr>
</TABLE>
<BR>
<%
}
%>

</body>
<center>
<a href="index.html">Go</a>
</center>
</html>
 
 
3. tables for patient registration using mysql(table name is prg and healthRecords table) :
 
 desc healthRecords;(patient healthRecords table)
+--------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| prescription | varchar(30) | YES | | NULL | |
| BP | varchar(30) | YES | | NULL | |
| HeartBeat | varchar(30) | YES | | NULL | |
| pastdiseases | varchar(30) | YES | | NULL | |
| pnmt | varchar(30) | YES | | NULL | |
+--------------+-------------+------+-----+---------+-------+
 
where pnmt means patient name for healthRecords table
 
desc prg;(patient registration table)
+--------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+---------------+------+-----+---------+----------------+
| ID | mediumint(9) | NO | PRI | NULL | auto_increment |
| ctgy | varchar(30) | YES | | NULL | |
| name | varchar(30) | YES | | NULL | |
| age | varchar(35) | YES | | NULL | |
| gender | varchar(4) | YES | | NULL | |
| profs | varchar(30) | YES | | NULL | |
| photo | varchar(4000) | YES | | NULL | |
| mobile | varchar(30) | YES | | NULL | |
| email | varchar(30) | YES | | NULL | |
+--------+---------------+------+-----+---------+----------------+ 
 
 
 

Answers (2)