am writting my class work project assignment but am stuck can some one help me out,
am tring to pick data from patients table and diagnosistreatment tables which are mysql tables but the code is not working

<?php 
//This code retrieves a particulat patients record from dianosis and treatment table
// Connects to your Database 
require_once('Connections/Database.php');
mysql_select_db($database_Database, $Database);
//checks if a number was entered
if (!$_POST['pnum'] ) 
{
die('You did not complete all of the required fields');
}
$a=$_POST['pnum'];
$stat="SELECT * FROM diagnosistreatment ,patients WHERE pID='$a'";

if (isset($_POST['SUBMIT']))
{



$result1=mysql_query($stat);
$num=mysql_num_rows($result1);
if ($num<1)
{
exit("The Patient Number u have entered doesnt exist please make sure u entered the right Patient number.<br>");
}
else
 echo"<table >";
while ($result=mysql_fetch_array($result1)) 
{

echo"<pre>          Patients number        :$result[pID] <br>
          Patients Names          :$result[pName] $result[pfName] <br>
          Age                     :$result[age] <br>
          Patients lives in       :$result[village] <br> 
          Department Visited      :$result[dept] <br> 
	  Sex                     :$result[sex] <br>
	  Tribe                   :$result[tribe] <br>
	  Presented with          :$result[symptoms] <br>
          Date visited            :$result[month] $result[day] $result[year]<br>
	  Patients Weight         :$result[wgt] Kilograms<br>
	  Patients Height         :$result[hgt] centimetres<br>
	  Temperature             :$result[temp] Degrees centigrade<br>
          Blood Pressure          :$result[bldp]mmhg <br>
	  Doctors ID              :$result[dID] <br>";





echo"<pre>          Doctor's/Clinicians ID   :$result[dID] <br>
          Patients NO              :$result[pID]<br>
          Treatment NO             :$result[treatmentnum]<br>
          Final diagois            :$result[finalDiagnosis] <br>
          Treatment Given          :$result[treatment] <br> 
          Date of Discharge        :$result[month] $result[day] $result[year]<br>
          Discharge Notes          :$result[dischargenotes] <br>
          Next Appointment         :$result[monthapt] $result[dayapt] $result[yearapt]<br> ";



}
echo"</table>";
}
?>

Please report about error on running php script -----is it a blank page or does show some semantic errors.
Check this preliminary hting out:-----
First of all u should connect to the mysql database to check whether u have connected successfully or not and then try comparing your tables of the database:

<?php

/*** mysql hostname ***/
$hostname = 'localhost';

/*** mysql username ***/
$username = 'username';

/*** mysql password ***/
$password = 'password';

/*** connect to the database ***/
$link = @mysql_connect($hostname, $username, $password);

/*** check if the link is a valid resource ***/
if(is_resource($link))
    {
    /*** if we are successful ***/
    echo 'Connected successfully';

    /*** close the connection ***/
    mysql_close($link);
    }
else
    {
    /*** if we fail to connect ***/
    echo 'Unable to connect';
    }
?>

test your query in phpmyadmin.

$stat="SELECT * FROM diagnosistreatment ,patients WHERE pID='$a'";

pID if in your two tables then mysql cannot determine which pID you'r selecting. select * from table1,table2 is not a correct way to select connected fields from two tables. LEts create relation, such as:

$stat="SELECT * FROM diagnosistreatment ,patients WHERE diagnosistreatment.pID=patients.pID AND patients.pID='$a'";

you should use mysql troubleshooting techniques:

$result1=mysql_query($stat) OR die(mysql_error());
This question has already been answered. Start a new discussion instead.