alin19 Posted August 21, 2008 Share Posted August 21, 2008 i have this code from a book i read, and i don't see whay it is not working the red one is the line from the book, the green one is write by me, neither one is working Parse error: parse error in c:\program files\easyphp1-8\www\test\verifica.php on line 18 <?php define ('DOCXML', 'student.xml'); header('Content-type:text/xml'); function verifica ($un_nume) { $dom=new DOMDocument (); $dom->load(DOCXML); if (!$dom) { return 0; } $radacina =$dom->documentElement; $utilizatori = $radacina->getElementByTagName('utilizator'); foreach ($utilizatori as $utilizator) { $nume=$utilizator->getElementByTagName('nume'); if ($un_nume!=$nume->item(0)->nodeValue) { if (!strcasecmp($un_nume,$nume->item(0)->nodeValue)) { return 1; } } return 0; } echo '<?xml version="1.0"?>'; ?> <raspuns> <metoda>verificaNume</metoda> <rezultat> <?php echo verifica($_REQUEST['nume']); ?> </rezultat> </raspuns> Link to comment https://forums.phpfreaks.com/topic/120709-domelement-error/ Share on other sites More sharing options...
MatthewJ Posted August 21, 2008 Share Posted August 21, 2008 if ($un_nume!=$nume->item(0)->nodeValue) { if (!strcasecmp($un_nume,$nume->item(0)->nodeValue)) { Shouldn't this be if ($un_nume!=$nume->item[0]->nodeValue) { if (!strcasecmp($un_nume,$nume->item[0]->nodeValue)) { Link to comment https://forums.phpfreaks.com/topic/120709-domelement-error/#findComment-621987 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.