0

iam try to retrieving data from multiple table and i want that data to be shown on one page.
can any one help me out what worng with this coding i cant get that resul which i want.
here is the coding

<? include("connection.php");
$q="select * from patient_detail,patient_information,patient_guardian_information,patient_discharge_information where patient_detail.patient_ID=patient_information.patient_ID and patient_information.patient_ID=patient_guardian_information.patient_ID and patient_guardian_information.patient_ID=patient_discharge_information.patient_ID";
$sql=mysql_query($q) or die(mysql_error());
$row=mysql_fetch_array($sql);

?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />



<style type="text/css">
<!--
.style4 {
	font-family: "Comic Sans MS";
	font-weight: bold;
	text-decoration: underline;
	text-align: center;
	color: #000000;
	font-size: 16px;
}
-->
</style>
</head>

<body>
<center>
      <p align="center" class="style1">
WELCOME TO ONLINE INFORMATION SYSTEMS FOR HOSPITAL EMERGENCY DEPARTMENT
<p/>
<center/>

<div class="transbox1">
  <div align="center">
   <table width="350" height="326" border="1">
  PATIENT PERSONAL INFOR/ DETAILS
    <tr><th width="217">&nbsp;patient ID</th>
    <td width="208"><? echo  $row["patient_ID"]  ?></td>
    </tr>
	<tr>  <th>&nbsp; first name</th><td><? echo  $row["first_name"]  ?></td></tr>
	<tr><th>&nbsp; last name</th><td><? echo  $row["last_name"]  ?></td></tr>
	<tr><th>&nbsp; surname</th><td><? echo  $row["surname"]  ?></td></tr>
	<tr> <th>&nbsp; gender</th><td><? echo  $row["gender"]  ?></td></tr>
	<tr><th>&nbsp; date of birth</th><td><? echo  $row["date_of_birth"]  ?></td></tr>
	<tr>  <th>&nbsp; address</th><td><? echo  $row["address"]  ?></td></tr>
	<tr><th>&nbsp; phone no (home)</th><td><? echo  $row["phone_no_home"]  ?></td></tr>
	<tr><th>&nbsp; phone no (mob)</th><td><? echo  $row["phone_no_mob"]  ?></td></tr>
	<tr><th>&nbsp; patient occupation</th><td><? echo  $row["patient_occupation"]  ?></td></tr>
	<tr>  <th>&nbsp; civil status</th><td><? echo  $row["civil_status"]  ?></td></tr>
	<tr> <th>&nbsp; account type</th><td><? echo  $row["account_type"]  ?></td></tr>
	<tr><th>&nbsp; company name</th><td><? echo  $row["company_name"]  ?></td></tr>
      <tr><td>patient discharge</td></tr> 
 <tr><th>&nbsp; discharge id</th><td><? echo  $row["discharge_ID"]  ?></td></tr>
     <tr><th>&nbsp;admssion id</th><td><? echo  $row["admission_ID"]  ?></td></tr>
      <tr><td>guardg</td></tr>
	 
	 <tr><th>&nbsp; guardian id</th><td><? echo  $row["guardian_ID"]  ?></td></tr>
     <tr><th>&nbsp; first name</th><td><? echo  $row["patient_guardian_information.first_name"]  ?></td></tr>
     <tr><td>inform</td></tr>
	 
	 <tr><th>&nbsp; admission_date</th><td><? echo  $row["admission_date"]  ?></td></tr>
     <tr><th>&nbsp; admission_time</th><td><? echo  $row["admission_time"]  ?></td></tr>
     
 
 






     <tr><td><input type="button" onclick="window.print()" value="PRINT IT !!!"  /></td></tr>
  </table>
  </div>
</div>

</body>
</html>
2
Contributors
6
Replies
10
Views
6 Years
Discussion Span
Last Post by soomro_moon
0

It would be helpful to know what result you are looking for. This code will display one result, or empty fields.

0

Instead of fetching one row, you would need to use a loop:

while ($row = mysql_fetch_array($sql))
{
  // output your table row
}

So, you'll have to move some code.

Edited by pritaeas: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.