> I am pretty up to standard with getting stuff into and out of mysql, > so I am basically just in need of pointers with generating the text > file and ftp'ing automatically. > It would be an even greater plus if it wasn't actually necessary to > create a physical text file on the hard drive, but to simply ftp the > "memory" file via the ftp functions, but I don't think that is > possible?
In fact, it is...just open the file on the ftp directly <? $fp = fopen( 'ftp://ftp.domain.com/file.txt', 'w' ); ?> You can then write directly to that filepointer: <? fwrite( $fp, 'some text' ); ?> Don't forget to close the file (I think PHP does that anyway, but it's nicer if you do that) <? fclose( $fp ); ?> > > My routine will already have connections to the db, and the query will > have already been run > (something like select number from table where group=1) > and I would then have a while to step through the result set. > This is where I need help, how to "create" the file and add the > numbers and "static" text to the file, and once completed with the > loop, to ftp to a server with username and password. You'll have to loop trough the resultset <? $query = 'select number from table where group=1'; $result = mysql_query( $query ); $content = ''; while ( $res = mysql_fetch_array( $result ) ) // This piece of code will add all the Cellphone-numbers to the $content variable { $content .= 'Cellphone: ' . $res['number'] . "\n"; } $content .= 'Reference: ' . $reference . "\n"; $content .= 'Notify: ' . $notify . "\n"; // And add everything else to the $content variable which needs to be written $fp = fopen('ftp://ftp.domain.com', 'w' ); fwrite( $fp, $content ); fclose( $fp ); ?> HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php