Table1
Bill
billno
P001
P002
Table2
Patient
Patno service amount
P001 s1 100
P002 zz 200
P001 s2 400
....
(1)if more then one Patno exists for a particular billno then add all the services(concat enate) and add all the amount .
(2)if only one result ...then simply print that.
(3)This is how i am doing it.....
(4)My problem is that it works fine for printing the first row as shown in the table below.But does not move forward for the second row.During the second iteration of for loop it does not enter the while loop .Why does it not enter the while loop second time.I want to make it enter the while loop.Then only will my problem will be solved.
(5)Any other way of getting the result i want ..that you can give.
How i want the results........ .......
billno service amount
P001 s1,s2 500
P002 zz 200
...
...
...
Bill
billno
P001
P002
Table2
Patient
Patno service amount
P001 s1 100
P002 zz 200
P001 s2 400
....
(1)if more then one Patno exists for a particular billno then add all the services(concat enate) and add all the amount .
(2)if only one result ...then simply print that.
(3)This is how i am doing it.....
Code:
for(traversing all the billno values one by one)
{
check=0;
while($row = mysql_fetch_array($execute_query,MYSQL_NUM))
{
if(billno == Patno)
{
service = service + $row[1];
amt = amt + $row[2] ;
check=1;
}
}
if(check=1) /*make sure there is atleast one match*/
{
print the table as desired.
}
}
(5)Any other way of getting the result i want ..that you can give.
How i want the results........ .......
billno service amount
P001 s1,s2 500
P002 zz 200
...
...
...
Comment