RE: [PHP-DB] fwrite()
| From: | Gurhan Ozen | Date: | Fri, 25 Jan 2002 20:50:28 +0000 |
| Subject: | RE: [PHP-DB] fwrite() | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-16184@lists.php.net to get a copy of this message | ||
You don't have anything to write to the file.. mysql_query() function
returns true or false, it doesn't return the actual qurey result you'd see
in mysql monitor. You have to use some other functions such as
mysql_fetch_array(), mysql_num_rows() to retrieve the data before you can
write it into a file.
Gurhan
-----Original Message-----
From: James Kupernik [mailto:kupernik@bcn.net]
Sent: Friday, January 25, 2002 3:39 PM
To: php-db@lists.php.net
Subject: [PHP-DB] fwrite()
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 dark
problem?
$db = mysql_connect("localhost","cloft","spring");
mysql_select_db("countryloft");
// get requests from table
$result = mysql_query("SELECT * FROM catalogreq WHERE PROCESSED IS
NULL");
$fp = fopen("$DOCUMENT_ROOT/catalogreq/catalogs.txt","w");
fwrite($fp, $result);
fclose($fp);
$updatereq = mysql_query("UPDATE catalogreq SET PROCESSED = 'Y'");
echo "Thank you!";
Thanks for any help!
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
For additional commands, e-mail: php-db-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net