I'm trying to do a php file using DOM in order to append a few table rows to my table whenever my SQL table is updated. The problem is, the function getElementById never works and i don't get why. here's the code:
$doc = new DomDocument();
$doc->validateOnParse = true;
$doc->load('home.php');
$element = $doc->getElementById('table-responsive'); //this is a div
$teste = $doc->createElement('div');
$element->appendChild($test);
I always get error 500 because the getElementById is not found/ doesn't work. Any ideas ?