Still when I make the changes suggested the file will not be created, yet I
get no form of an error message.

Is there something else I'm missing?

> I'm trying to take the contents of a table and write them to a file on my
> server. Everything seems to function ok (AKA no errors) but no file gets
> written ... I can't figure out why. Can anyone shine some light on this
> problem?
>           $db = mysql_connect("localhost","cloft","spring");
>           mysql_select_db("countryloft");
>           // get requests from table
>           $result = mysql_query("SELECT * FROM catalogreq WHERE PROCESSED
> NULL");
>           $fp = fopen("$DOCUMENT_ROOT/catalogreq/catalogs.txt","w");
>           fwrite($fp, $result);
>           fclose($fp);
>           $updatereq = mysql_query("UPDATE catalogreq SET PROCESSED =
>           echo "Thank you!";
> Thanks for any help!

fwrite() needs a string as its second parameter. You are passing a
DB result index. Even if a file were being created, it would not
contain what you had hoped for.

You will need to use $result with mysql_fetch_array() in order to
get any useful data out of it. However, that function will return
arrays of data, which you will need to massage into your deisred
format and issue it in the form of a string to fwrite().

Daniel J. Lashua

PHP Database Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to