need help writing database entires to file

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

    need help writing database entires to file

    I have used dreamweaver to do a lot of php "programmin g" but now I need to
    write a real php function.

    I have a hosted mysql database that I need to export to MS Access. I can't
    use myODBC to do it because hosting company denies access to db port. I
    looked at other ways to dump the data but the escaped characters always
    threw the import off. There probably a way to do using MySQLDUMP command.
    HOwever, I remember a long time ago I wrote some code to read raw data into
    lotus notes and figured there is probably a way to write out the data using
    whatever field & record terminators I choose.

    Keeping in mind the end goal is to write on e that is friendly to import
    into MS Access, does anyone have an idea of how to use PHP to write a mysql
    db out to a *.txt file formatted for easy import to MS Access?

    If not, does anyone know how to write a mysql db out to a file?

    Many thanks!


  • Phlarmf

    #2
    Re: need help writing database entires to file


    "NotGiven" <noname@nonegiv en.net> wrote in message
    news:vI%jb.1112 9$h47.6101@bign ews4.bellsouth. net...[color=blue]
    > I have used dreamweaver to do a lot of php "programmin g" but now I need to
    > write a real php function.
    >
    > I have a hosted mysql database that I need to export to MS Access. I[/color]
    can't[color=blue]
    > use myODBC to do it because hosting company denies access to db port. I
    > looked at other ways to dump the data but the escaped characters always
    > threw the import off. There probably a way to do using MySQLDUMP command.
    > HOwever, I remember a long time ago I wrote some code to read raw data[/color]
    into[color=blue]
    > lotus notes and figured there is probably a way to write out the data[/color]
    using[color=blue]
    > whatever field & record terminators I choose.
    >
    > Keeping in mind the end goal is to write on e that is friendly to import
    > into MS Access, does anyone have an idea of how to use PHP to write a[/color]
    mysql[color=blue]
    > db out to a *.txt file formatted for easy import to MS Access?
    >
    > If not, does anyone know how to write a mysql db out to a file?
    >
    > Many thanks!
    >[/color]


    You can create custom deliniated text files with mysql with


    SELECT INTO OUTFILE '/path/to/file/to/create.txt'
    FIELDS
    TERMINATED BY '\t'
    ENCLOSED BY ''
    ESCAPED by '\\'
    LINES
    STARTING BY ''
    TERMINATED BY '\n'
    FROM ....(where, group by, having, etc)


    The values given are the defaults if you don't specify them. Make sure MySQL
    has write permissions on '/path/to/file/to/'.


    Comment

    • NotGiven

      #3
      Re: need help writing database entires to file

      Many thanks. I'll give it a try!

      "Phlarmf" <no@email.com > wrote in message
      news:p4ekb.1222 91$pl3.46313@pd 7tw3no...[color=blue]
      >
      > "NotGiven" <noname@nonegiv en.net> wrote in message
      > news:vI%jb.1112 9$h47.6101@bign ews4.bellsouth. net...[color=green]
      > > I have used dreamweaver to do a lot of php "programmin g" but now I need[/color][/color]
      to[color=blue][color=green]
      > > write a real php function.
      > >
      > > I have a hosted mysql database that I need to export to MS Access. I[/color]
      > can't[color=green]
      > > use myODBC to do it because hosting company denies access to db port. I
      > > looked at other ways to dump the data but the escaped characters always
      > > threw the import off. There probably a way to do using MySQLDUMP[/color][/color]
      command.[color=blue][color=green]
      > > HOwever, I remember a long time ago I wrote some code to read raw data[/color]
      > into[color=green]
      > > lotus notes and figured there is probably a way to write out the data[/color]
      > using[color=green]
      > > whatever field & record terminators I choose.
      > >
      > > Keeping in mind the end goal is to write on e that is friendly to import
      > > into MS Access, does anyone have an idea of how to use PHP to write a[/color]
      > mysql[color=green]
      > > db out to a *.txt file formatted for easy import to MS Access?
      > >
      > > If not, does anyone know how to write a mysql db out to a file?
      > >
      > > Many thanks!
      > >[/color]
      >
      >
      > You can create custom deliniated text files with mysql with
      >
      >
      > SELECT INTO OUTFILE '/path/to/file/to/create.txt'
      > FIELDS
      > TERMINATED BY '\t'
      > ENCLOSED BY ''
      > ESCAPED by '\\'
      > LINES
      > STARTING BY ''
      > TERMINATED BY '\n'
      > FROM ....(where, group by, having, etc)
      >
      >
      > The values given are the defaults if you don't specify them. Make sure[/color]
      MySQL[color=blue]
      > has write permissions on '/path/to/file/to/'.
      >
      >[/color]


      Comment

      Working...