modify chars in files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Bedford

    #1

    modify chars in files

    I've an XML file where I've "'" char. I want to modify in all file the
    "&apos" by "'". it's there any way to do it before parsing the XML file ?

    Bob


  • Hartmut Holzgraefe

    #2
    Re: modify chars in files

    Bob Bedford wrote:[color=blue]
    > I've an XML file where I've "'" char. I want to modify in all file
    > the "&apos" by "'". it's there any way to do it before parsing the XML
    > file ?[/color]

    Why do you want to do that? The various XML parsing PHP extensions
    will transparently handle that for you anyway ...

    --
    Hartmut Holzgraefe, Senior Support Engineer .
    MySQL AB, www.mysql.com

    Are you MySQL certified? www.mysql.com/certification

    Comment

    • Bob Bedford

      #3
      Re: modify chars in files


      "Hartmut Holzgraefe" <hartmut@mysql. com> a écrit dans le message de news:
      csl9bp$ubv$2@on line.de...[color=blue]
      > Bob Bedford wrote:[color=green]
      >> I've an XML file where I've "&apos;" char. I want to modify in all file
      >> the "&apos" by "'". it's there any way to do it before parsing the XML
      >> file ?[/color]
      >
      > Why do you want to do that? The various XML parsing PHP extensions
      > will transparently handle that for you anyway ...
      >
      > --
      > Hartmut Holzgraefe, Senior Support Engineer .
      > MySQL AB, www.mysql.com
      >
      > Are you MySQL certified? www.mysql.com/certification
      >[/color]
      Probably I didn't get the right extension, but when trying to get
      attributes, the parser separate my text in 3
      text: xxxxx'yyy
      output:
      xxxxx
      '
      yyy

      Anyway I want to save such string in a Mysql table, so I've to care about,
      as the insert statement is like insert.....,'xx xxx'yyy',
      I've removed the ' with ereg_replace, but I'd like to get such character in
      Mysql table, but don't know how.

      Bob


      Comment

      • Hartmut Holzgraefe

        #4
        Re: modify chars in files

        Bob Bedford wrote:[color=blue]
        > Probably I didn't get the right extension, but when trying to get
        > attributes, the parser separate my text in 3
        > text: xxxxx'yyy
        > output:
        > xxxxx
        > '
        > yyy[/color]

        This is something you always have to be aware of:
        The parser may split character data into several chunks
        and it is your responsibility to join them together if
        needed.
        [color=blue]
        > Anyway I want to save such string in a Mysql table, so I've to care
        > about, as the insert statement is like insert.....,'xx xxx'yyy',
        > I've removed the ' with ereg_replace, but I'd like to get such character
        > in Mysql table, but don't know how.[/color]

        Escapes special characters in a string for use in an SQL statement


        --
        Hartmut Holzgraefe, Senior Support Engineer .
        MySQL AB, www.mysql.com

        Are you MySQL certified? www.mysql.com/certification

        Comment

        • Bob Bedford

          #5
          Re: modify chars in files

          > http://php.net/mysql_real_escape_string

          Thanks for your asnwer.
          I've seen you are senior support Enginner for mysql, you probably may help
          for a question that wasn't answered. (very short)

          I've a page where I get the result of a query. Each result points to a page
          where there is the detail of the record. I'd like to add "previous" and
          "next"butto ns. The only way I've found is to put the results in an array,
          then on any page, the array will tell me the next and previous record. It's
          there a better way using mysql ?

          Bob


          Comment

          • Jacob Atzen

            #6
            Re: modify chars in files

            On 2005-01-19, Bob Bedford <bedford1@YouKn owWhatToDoHereh otmail.com> wrote:[color=blue]
            > I've a page where I get the result of a query. Each result points to a
            > page where there is the detail of the record. I'd like to add
            > "previous" and "next"butto ns. The only way I've found is to put the
            > results in an array, then on any page, the array will tell me the next
            > and previous record. It's there a better way using mysql ?[/color]

            Offsets:

            SELECT [...] FROM [table] LIMIT 20, 1;

            <http://dev.mysql.com/doc/mysql/en/SELECT.html>

            --
            Cheers,
            - Jacob Atzen

            Comment

            • Bob Bedford

              #7
              Re: modify chars in files

              "Jacob Atzen" <jacob@aub.dk > a écrit dans le message de news:
              slrncusnva.9mt. jacob@morpheus. aub.dk...[color=blue]
              > On 2005-01-19, Bob Bedford <bedford1@YouKn owWhatToDoHereh otmail.com>
              > wrote:[color=green]
              >> I've a page where I get the result of a query. Each result points to a
              >> page where there is the detail of the record. I'd like to add
              >> "previous" and "next"butto ns. The only way I've found is to put the
              >> results in an array, then on any page, the array will tell me the next
              >> and previous record. It's there a better way using mysql ?[/color]
              >
              > Offsets:
              >
              > SELECT [...] FROM [table] LIMIT 20, 1;
              >
              > <http://dev.mysql.com/doc/mysql/en/SELECT.html>
              >[/color]
              List.php (with limit 20):
              <a href="detail.ph p?article=2>det ail 2</a>
              <a href="detail.ph p?article=3>det ail 3</a>
              <a href="detail.ph p?article=4>det ail 4</a>
              .....

              Ok, once I click on article detail 3, how to make previous or next from
              there since I'm on an other page and I don't run the query every time ? From
              detail.php, it wouldn't be possible to go to 2 or 4 without coming back to
              list.php.

              Bob


              Comment

              Working...