The XML generated by the PHP grouping query has two tables: arp_individual is the patient information table, and arp_area is the inpatient room table, now we need to generate an XML document based on the number of patients in the room for flash animation calling. how can we implement such PHP code: ------------------------ The following is the XML generated by the CREATE & nbs PHP Group query in the patient info table.
There are two tables, arp_inpidual is the patient information table, and arp_area is the inpatient room table. now we need to generate an XML document based on the number of patients in the room for flash animation calls, the room field in patient information is associated with the id in the inpatient room table. how can this PHP code be implemented:
------------------------
The following table lists patient information.
CREATE TABLE `arp_inpidual` (
`id` int(11) NOT NULL default '0',
`inpidualid` varchar(60) character set latin1 default NULL,
`sex` int(11) default NULL,
`room` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
------------------------
The following table lists the inpatient rooms.
CREATE TABLE `arp_area` (
`id` mediumint(8) NOT NULL auto_increment,
`areaname` longtext,
`nurse` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2059 DEFAULT CHARSET=utf8;
------------------------
The generated XML data format is as follows:
......
------ Solution --------------------
DOMDocument generation
I didn't see how these two tables are associated. I guess there may be a third table.
------ Solution --------------------
I am still engaged in hospital work. I have previously made a hospital ticket.
Have several experiences:
1. private hospitals are full of tmd profitors. they must have a certain scale and should not be fooled and transferred.
2. public hospitals have to wait for a long time, and the approval process is extremely troublesome.
So I advise you that there is no NB-related relationship. the hospital doesn't need to be too deep ~
------ Solution --------------------
Why like?
SELECT COUNT(*), areaname FROM arp_inpidual i
LEFT JOIN arp_area a ON i.room = a.id
GROUP BY i.room
------ Solution --------------------
If you want someone to help you write code, you must at least:
1. relationship between tables
2. correspondence between the content in the output results and fields
------ Solution --------------------
Reference:
The above forgot to add a point, in fact, the room number information hidden room classification information, like the A01-01 horizontal bar behind the room number, the front side of the A01 is the area number, this is not my design, the hospital itself is numbered like this, no way!
Count the individual first, and then recycle the A01-01. String operations are easier than mysql operations .~
------ Solution --------------------
Since you are reluctant to provide data mappings
Output results cyclically by Ward count and sum