Mam problem z kodem zamieszczonym poniżej. Prosiłbym o pomoc w znalezieniu powodu występowania błędu.
Z góry dzięki za pomoc.
Kod Generuje następujący błąd :
Parse error: parse error, expecting `','' or `')'' in C:\xampp\htdocs\test\NewsUp.php on line 43
<?php include_once 'common.inc.php'; $doc = new DOMDocument(); $root = $doc->documentElement; $maxId = 0; foreach ($root->getElementsByTagName('author') as $xAuthor) { $id = $xAuthor->getAttribute('id'); if ($maxId < (int)$id) $maxId = (int)$id; $author = $_POST['author'][$id]; { $okToDelete = TRUE; $contentItem = simplexml_load_file($fileDir . $file); if ((string)$contentitem->authorid == (string)$id) { $okToDelete = FALSE; break; } } if ($okToDelete) $root->removeChild($xAuthor); else $deleteFailures[] = $id; } else { $name = $xAuthor->getElementsByTagName('name'); $name = $name->item(0); $name->nodeValue = $author['name']; $byline = $xAuthor->getElementsByTagName('byline'); $byline = $byline->item(0); $byline->nodeValue = $author['byline']; $email = $xAuthor->getElementsByTagName('email'); $email = $email->item(0); $email->nodeValue = $author['email']; } } } foreach ($_POST['newauthor'] as $author) { $xAuthor = $root->appendChild($doc->createElement('author')); $xAuthor->setAttribute('id', ++$maxId); $xAuthor->appendChild($doc->createElement('name', $author['name'])); $xAuthor->appendChild($doc->createElement('byline', $author['byline'])); $xAuthor->appendChild($doc->createElement('email', $author['email'])); } } } $doc->save($fileDir . 'news.xml'); $qs = '?'; foreach ($deleteFailures as $id) { $qs .= "id[]=$id&"; } ?>