Ok, i'm not sure if this thread belongs HERE exactly, and i might post it over in the DB forum because they might have better answers... BUT here goes.

I'm devoleping a little website the "extreme" way... that is... coding everything myself by hand and with .txt documents. It's been pretty doable up until now, but i've hit a hiccup.

I'm wanting to write my own news script, BUT, the kicker is i don't have mysql database access. So what's the best way to go about it? I've got no experience in XML, but have heard that it's doable there. I was actually thinking of having php generate a .txt document (named .nws or something) instead of having it submit to the mysql server and then making the script read the .nws files. But, i haven't got anything more than the most basic set of commands in my little bank of knodledge at my fingertips.

So, how would i go about making php create the files (like, what commands?) and read them, as well as taking OLD news files and deleting them. I don't need to archive data since this is just a pretty basic blogger for now.

Thanks for any help

    use
    $fh = fopen("nameofnewsfiles.nws","+w")
    this will attempt to create the file for writing and set the pointer and the beginning of the file. Then use
    fwrite($fh, "Text") to write to the file, followed by fclose().

    As for reading it,
    $text = file_get_contents("filename")
    will give you a nice variable containing the contents of the file.

    After this, use regular expressions (like preg_replace() to parse it.

      Write a Reply...