Update/Delete info in XML document via PHP

Code with C | Programming: Projects & Source Codes Forums PHP Update/Delete info in XML document via PHP

This topic contains 4 replies, has 1 voice, and was last updated by  SapnaVishwas 2 years, 7 months ago.

  • Author
  • #10851


    Update/Delete info in XML document via PHP

    This is what I got so far

    my .xml document

    and here i got my file which i want to run to delete my database entries and cleaning the xml entries but im have problem with my xml deletion part

    I get the following error message:

    can someone help me find a solution and edit the code for me please im a beginner and is strggling to solve the problem as far as I can see the problem must be

  • #10852


    What happens if you use:

    It maybe 0 indexed so 0,1,2 not 1,2,3. Not sure – haven’t used this myself.

  • #10853


    If we take a look at this line:

    You’re trying to fetch the third item of a list, a list which we just determined was empty. Thus it returns null, and it results in you trying to pass null to a method which expects an object.

    How to solve it involves some basic logic, which I am sure you can figure out on your own if you just think about it. There are many ways to test for what you want, after all.

  • #10854


    Just add:


    and it will save back to the file.

  • #10855


    I found the solution but there’s something else that is bugging me now

    This delete each record as I refresh it each time, isn’t there a way to delete all at once or create a table where I can tick off to delete each record? and after I deleted all the records isn’t there a way to tell me there are no more records and link me back to the index? in place of getting the error

You must be logged in to reply to this topic.