Hey,
For better or worse I've spent the entire day playing with databases, dom, and templates...so I should be warmed up, but also a little brain-fried. :-)
The two things I notice off the top are in your final DOM loop you're calling the wrong object to fill its childNode
foreach ( $divs as $div )
{
if ( $div->getAttribute('id') == 'location_name' )
{
$tag->nodeValue = 'Location Name...';
}
}
Should be a $div
foreach ( $divs as $div )
{
if ( $div->getAttribute('id') == 'location_name' )
{
$div->nodeValue = 'Location Name...';
}
}
I also want to make sure that you're instantiating your dom-object before trying to use the methods in your database query loop?
$doc = new DOMDocument('1.0');
$doc->loadHTMLFile( 'test.html' );
foreach($rpthdr as $hdr)
{
$customer_id = $hdr['customer_id'];
$location_id = $hdr['location_id'];
$morning = $db->Query("SELECT... WHERE... t1.customer_id = '$customer_id' AND t1.location_id = '$location_id' AND t3.report_type = 'morning'");
foreach($morning as $rpt2)
{
$td = $doc->createElement('td');
$td->nodeValue = $rpt2['report'];
$rpt1->appendChild( $td );
}
Here have you you already called the $doc = new DOMDocument('1.0'); and loadHTML methods?
:-)