How to write textfiles with php?

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

    How to write textfiles with php?

    Hey guys.

    Anybody has an idea how to write data from mysql source into a textfile?


    Thanks for help.

    -------------------------------
    Fav pages:
    PSP Spiele: http://www.psp-spiele.net
    XBOX360 Spiele: http://www.xbox360-spiele.net


  • Kimmo Laine

    #2
    Re: How to write textfiles with php?

    "Micheal Corleone" <31337@web.de > kirjoitti
    viestissä:ddlae 6$qug$01$1@news .t-online.com...[color=blue]
    > Hey guys.
    >
    > Anybody has an idea how to write data from mysql source into a textfile?
    >
    >
    > Thanks for help.[/color]


    If you honestly say you couldn't figure it out by reading the manual, you
    have bigger problems than that. Anyhow, here's a little example.

    $my_result = mysql_query($q = "select * from mytable") or die($q .
    mysql_error());
    $my_filepointer = fopen("mytextfi le.txt", "w");
    while($row = mysql_fetch_arr ay($my_result)) {
    fputs($my_filep ointer, implode(';', $row));
    }
    fclose($my_file pointer);

    I'm not gonna debug that, so it may contain errors, but you'll get the basic
    idea.

    --
    SETI @ Home - Donate your cpu's idle time to science.
    Further reading at <http://setiweb.ssl.ber keley.edu/>
    Kimmo Laine <eternal.erecti onN0@5P4Mgmail. com>


    Comment

    Working...