note); /*foreach($xmla->note as $test){ if($nb < $test['id']){$nb=$test['id'];} }*/ $test = $xmla->note; for($i=0;$i<$field_count;$i++){ if($nb <= $test[$i]['id']) $nb = $test[$i]['id']+1; } $newnote = $xmla->addChild('note'); $newnote->addAttribute("id", $nb); $newnote->addChild('text', $body); $newnote->addChild('color', $color); $newnote->addChild('zindex', $zindex); $newnote->addChild('top', '0'); $newnote->addChild('left', '0'); $xmla->asXML('../db/notes.xml'); echo $nb;