Edit report at https://bugs.php.net/bug.php?id=55836&edit=1

 ID:                 55836
 User updated by:    keyboard27 dot 10 at gmail dot com
 Reported by:        keyboard27 dot 10 at gmail dot com
 Summary:            main()-warning
 Status:             Open
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Windows 7
-PHP Version:        Irrelevant
+PHP Version:        5.3.1
 Block user comment: N
 Private report:     N

 New Comment:

Sorry for the double code...


Previous Comments:
------------------------------------------------------------------------
[2011-10-03 13:44:17] keyboard27 dot 10 at gmail dot com

Description:
------------
"Warning: main() [function.main]: Cannot add element <XML-element-name> number 
1 when only 0 such elements exist"
I get this error when trying to read from an xml-file.
In the file i need to jump to a parent-element from a child-element.
//Code:
if((int)$Verse_ID >= sizeof($Chap->Verse))
{
        if((int)$Chap_ID >= sizeof($Book[($Book_ID-1)]))
        {
                if((int)$Book_ID == sizeof($xml_Books->Book))
                {
                        $Book_ID = 1;
                        $Chap_ID = 1;
                        $Verse_ID = 1;
                }
                else
                {
                        $Book_ID++;
                        $Chap_ID = 1;
                        $Verse_ID = 1;
                }
        }
        else
        {
                $Chap_ID++;
                $Verse_ID = 1;
        }
}
else
{
        $Verse_ID++;
}
//$Chap, $xml_Books and $Book are xml-nodes

Test script:
---------------
//Code:
if((int)$Verse_ID >= sizeof($Chap->Verse))
{
        if((int)$Chap_ID >= sizeof($Book[($Book_ID-1)]))
        {
                if((int)$Book_ID == sizeof($xml_Books->Book))
                {
                        $Book_ID = 1;
                        $Chap_ID = 1;
                        $Verse_ID = 1;
                }
                else
                {
                        $Book_ID++;
                        $Chap_ID = 1;
                        $Verse_ID = 1;
                }
        }
        else
        {
                $Chap_ID++;
                $Verse_ID = 1;
        }
}
else
{
        $Verse_ID++;
}
//$Chap, $xml_Books and $Book are xml-nodes



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55836&edit=1

Reply via email to