Can I do this to write out html file using fopen

From: Date: Wed, 07 Feb 2001 16:29:00 +0000
Subject: Can I do this to write out html file using fopen
Groups: php.general 
Request: Send a blank email to php-general+get-38476@lists.php.net to get a copy of this message
Hi people, the syntax below is what I intend to use it to write out the customer detail on a new file according the customer ID. I only make it rough and short and did not go too detail on it, have limited experience oho here in some way. <?php (db connection bit)..... $queryRequest = "SELECT * FROM TouristRequests WHERE TouristRequestID='$TouristRequestID'"; $resultRequest = mysql_query($queryRequest); // to write out the new output file $fileName = "$TouristRequestID"; $fileName .= ".php3"; $htmlFile = fopen("$fileName", "w"); $linkToApp = "https://www.manageasy.com/" . "requestDetail.php3?filename=$fileName&TouristRequestID=$TouristRequestID"; if (!($htmlFile)) { print("file could not be opened."); exit; } // Write out Page. fputs($htmlFile, "<? \n"); fputs($htmlFile, "if(!(\$PHP_AUTH_USER)): \n"); fputs($htmlFile, " echo '<meta http-equiv=\"refresh\" content=\"0;url=https://www.manageasy.com/requestDetail.php3?TouristRequestID=$TouristRequestID&filename=$fileName\">'; \n"); fputs($htmlFile, " exit; \n"); fputs($htmlFile, "endif \n"); fputs($htmlFile, "?> \n"); fputs($htmlFile, "<HTML>\n"); fputs($htmlFile, "<HEAD>\n"); fputs($htmlFile, "<TITLE>Customer detail</TITLE>\n"); (and blabla.... until the end of the file). fputs($htmlFile, "</BODY>\n"); fputs($htmlFile, "</HTML>\n"); ********************************** And there is nothing in the file requestDetail.php3 beside the sniplet for db connection like this: <?php $connection = mysql_connect("$localhost", "username", "password"); mysql_select_db("dbname", $connection); ?> ***************************** Is this correct way to do this? cheers Jack jacky@activelifestyle.com "There is nothing more rewarding than reaching the goal you set for yourself"

« previous php.general (#38476) next »