SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2007
    Location
    Canandaigua, NY
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Need help with Looping Please

    I need to do a looping program for my website. A basic PHP code to generate XML. I am new to this, and not sure if I need help with MySQL or not.

    Please Help or PM me. Would love to talk to someone on the phone about it.
    Thanks,
    Don

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,494
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    While, do-while, for, foreach

    All about loops in PHP

  3. #3
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Building XML is easy, you're just constructing a string.
    Be familiar with how to concatenate strings, and read the functions guido linked you to. Then just use file_put_contents to write the string as an XML file.
    PHP Code:
    $xml = "<?xml .....";

    foreach(
    $myArray as $el) {
       
    $xml.= "...append elements here....";
    }

    //Write to file
    file_put_contents('myxmlfile.xml', 
    $xml);

  4. #4
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,625
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    XML is not a string. XML is a node tree. Use the proper functions to create XML as an object, or risk dealing with fun character encoding issues.

  5. #5
    Non-Member
    Join Date
    Oct 2007
    Location
    United Kingdom
    Posts
    623
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    hmmm

  6. #6
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,494
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by ro0bear View Post
    hmmm
    A man of few words...

  7. #7
    Non-Member
    Join Date
    Oct 2007
    Location
    United Kingdom
    Posts
    623
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    lol, sorry, new today, just seeing how the forums work lol. so doing a bit of 'hmm' ing and 'arrhhh' ing and 'ah ha' ing. trying to find where IM is.

  8. #8
    SitePoint Enthusiast
    Join Date
    May 2007
    Location
    Canandaigua, NY
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, I read what you suggested, but I still need help. Is there anyone who can help me?

    PM Me Please so we can talk.

    I appreciate it, thanks.

    Don


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •