PHP Classes

File: csv2html-SourceDisplay.html

Recommend this page to a friend!
  Classes of Srinivasan Ramakrishnan   csvtohtml   csv2html-SourceDisplay.html   Download  
File: csv2html-SourceDisplay.html
Role: ???
Content type: text/plain
Description: HTML formatted source - makes easier reading :0)
Class: csvtohtml
Converts a CSV file into a HTML table
Author: By
Last change:
Date: 23 years ago
Size: 22,694 bytes
 

Contents

Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- saved from url=(0065)http://127.1/code/source.php?url=./projects/csv-htmltable/csv.inc --> <HTML><HEAD><TITLE>Source Display</TITLE> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META content="MSHTML 5.50.4522.1800" name=GENERATOR></HEAD> <BODY> <TABLE width="100%" align=center bgColor=#6699cc> <TBODY> <TR> <TD align=middle><B>Source listing for <PRE>csv.inc</PRE></B></TD></TR></TBODY></TABLE><CODE><FONT color=#000000><FONT color=#0000bb>&lt;?php <BR></FONT><FONT color=#ff8000>/**************************************************************************************** <BR>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CSV2HTML&nbsp;-&nbsp;PHP&nbsp;code&nbsp;by&nbsp;Srinivasan&nbsp;Ramakrishnan,&nbsp;cheeni@bigfoot.com&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* <BR>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;http://www.sriniram.com,&nbsp;03/FEB/2001&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* <BR>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Free&nbsp;for&nbsp;non-commercial&nbsp;use.&nbsp;For&nbsp;commercial&nbsp;use&nbsp;please&nbsp;contact&nbsp;author.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* <BR>*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;warranties&nbsp;of&nbsp;correctness&nbsp;are&nbsp;extended&nbsp;for&nbsp;non-commercial&nbsp;usage.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* <BR>****************************************************************************************/ <BR>/* <BR>csvtohtml&nbsp; <BR>(PHP3&nbsp;&gt;=&nbsp;3.0.8,&nbsp;PHP4) <BR>csvtohtml&nbsp;--&nbsp;Converts&nbsp;a&nbsp;CSV&nbsp;file&nbsp;to&nbsp;a&nbsp;HTML&nbsp;table <BR><BR>Description: <BR>&amp;string&nbsp;[&amp;boolean]&nbsp;&amp;csvtohtml(string&nbsp;$csvFilePath,&nbsp;string&nbsp;$htmlFilePath,&nbsp;int&nbsp;$maxRowLength,&nbsp;string&nbsp;$htmlTableStyle&nbsp;[,&nbsp;string&nbsp;$delimiterString&nbsp;=&nbsp;","]) <BR><BR>string&nbsp;$csvFilePath&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;Must&nbsp;point&nbsp;to&nbsp;a&nbsp;valid&nbsp;CSV&nbsp;file&nbsp;path <BR><BR>string&nbsp;$htmlFilePath&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;The&nbsp;output&nbsp;HTML&nbsp;file&nbsp;destination&nbsp;path,&nbsp;NULL&nbsp;if&nbsp;output&nbsp;is&nbsp;to&nbsp;be&nbsp;only&nbsp;as&nbsp;return&nbsp;value. <BR><BR>int&nbsp;$maxRowLength&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;The&nbsp;max&nbsp;number&nbsp;of&nbsp;characters&nbsp;on&nbsp;any&nbsp;line&nbsp;in&nbsp;the&nbsp;CSV&nbsp;file <BR><BR>string&nbsp;$htmlTableStyle&nbsp;&nbsp;-&nbsp;The&nbsp;HTML&nbsp;style&nbsp;elements&nbsp;in&nbsp;a&nbsp;table,&nbsp;can&nbsp;be&nbsp;left&nbsp;as&nbsp;a&nbsp;zero&nbsp;length&nbsp;string&nbsp;for&nbsp;default&nbsp;styling&nbsp;as&nbsp;per&nbsp;browser <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ex:&nbsp;'align="center"&nbsp;background="bg.gif"&nbsp;border="3"' <BR><BR>string&nbsp;$delimiterString&nbsp;-&nbsp;By&nbsp;default&nbsp;assumed&nbsp;as&nbsp;,&nbsp;(comma).&nbsp;Denotes&nbsp;the&nbsp;delimiting&nbsp;character&nbsp;between&nbsp;fields&nbsp; <BR><BR>Usage: <BR>The&nbsp;function&nbsp;will&nbsp;return&nbsp;a&nbsp;reference&nbsp;to&nbsp;a&nbsp;variable&nbsp;containing&nbsp;the&nbsp;HTML&nbsp;code&nbsp; <BR>for&nbsp;creating&nbsp;the&nbsp;table&nbsp;containing&nbsp;the&nbsp;CSV&nbsp;records.However&nbsp;an&nbsp;output&nbsp;HTML&nbsp;file&nbsp; <BR>path&nbsp;may&nbsp;be&nbsp;specified&nbsp;to&nbsp;allow&nbsp;output&nbsp;to&nbsp;an&nbsp;HTML&nbsp;file.&nbsp;The&nbsp;returned&nbsp;reference&nbsp; <BR>will&nbsp;contain&nbsp;a&nbsp;boolean&nbsp;false&nbsp;if&nbsp;an&nbsp;error&nbsp;occurs. <BR><BR>If&nbsp;output&nbsp;need&nbsp;not&nbsp;be&nbsp;stored&nbsp;as&nbsp;an&nbsp;HTML&nbsp;file&nbsp;the&nbsp;$htmlFilePath&nbsp;must&nbsp;be&nbsp;set&nbsp;to&nbsp;NULL. <BR><BR>Ex: <BR><BR>$output&nbsp;=&nbsp;&amp;csvtohtml("test.csv",&nbsp;NULL,&nbsp;1000,&nbsp;"border='0'",&nbsp;";"); <BR><BR>csvtohtml("test.csv",&nbsp;"test.html",&nbsp;1000,&nbsp;"border='0'",&nbsp;";"); <BR><BR>$output&nbsp;=&nbsp;&amp;csvtohtml("test.csv",&nbsp;"test.html",&nbsp;1000,&nbsp;""); <BR><BR>*/ <BR><BR></FONT><FONT color=#007700>require(</FONT><FONT color=#dd0000>"errOut.inc"</FONT><FONT color=#007700>); <BR><BR>function&nbsp;&amp;</FONT><FONT color=#0000bb>csvtohtml</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$csvFilePath</FONT><FONT color=#007700>,&nbsp;</FONT><FONT color=#0000bb>$htmlFilePath</FONT><FONT color=#007700>,&nbsp;</FONT><FONT color=#0000bb>$maxRowLength</FONT><FONT color=#007700>,&nbsp;</FONT><FONT color=#0000bb>$htmlTableStyle</FONT><FONT color=#007700>,&nbsp;</FONT><FONT color=#0000bb>$delimiterString&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#dd0000>","</FONT><FONT color=#007700>){ <BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;if(</FONT><FONT color=#0000bb>file_exists</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$csvFilePath</FONT><FONT color=#007700>)){ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</FONT><FONT color=#0000bb>$csvFileHndl&nbsp;</FONT><FONT color=#007700>=&nbsp;@</FONT><FONT color=#0000bb>fopen</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$csvFilePath</FONT><FONT color=#007700>,</FONT><FONT color=#dd0000>"r"</FONT><FONT color=#007700>)){ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$htmlOut&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#dd0000>"&lt;table&nbsp;"&nbsp;</FONT><FONT color=#007700>.&nbsp;</FONT><FONT color=#0000bb>$htmlTableStyle&nbsp;</FONT><FONT color=#007700>.&nbsp;</FONT><FONT color=#dd0000>"&gt;"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$row&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#0000bb>1</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while&nbsp;(</FONT><FONT color=#0000bb>$data&nbsp;</FONT><FONT color=#007700>=&nbsp;@</FONT><FONT color=#0000bb>fgetcsv&nbsp;</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$csvFileHndl</FONT><FONT color=#007700>,&nbsp;</FONT><FONT color=#0000bb>$maxRowLength</FONT><FONT color=#007700>,&nbsp;</FONT><FONT color=#0000bb>$delimiterString</FONT><FONT color=#007700>))&nbsp;{ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$num&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#0000bb>count&nbsp;</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$data</FONT><FONT color=#007700>); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#ff8000>/*&nbsp;Skip&nbsp;empty&nbsp;lines&nbsp;*/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#007700>if(</FONT><FONT color=#0000bb>$data</FONT><FONT color=#007700>[</FONT><FONT color=#0000bb>0</FONT><FONT color=#007700>]&nbsp;!=&nbsp;</FONT><FONT color=#0000bb>NULL&nbsp;</FONT><FONT color=#007700>&amp;&amp;&nbsp;</FONT><FONT color=#0000bb>$num&nbsp;</FONT><FONT color=#007700>&gt;&nbsp;</FONT><FONT color=#0000bb>1</FONT><FONT color=#007700>){ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$htmlOut&nbsp;</FONT><FONT color=#007700>.=&nbsp;</FONT><FONT color=#dd0000>"&lt;tr&gt;\n"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for&nbsp;(</FONT><FONT color=#0000bb>$c</FONT><FONT color=#007700>=</FONT><FONT color=#0000bb>0</FONT><FONT color=#007700>;&nbsp;</FONT><FONT color=#0000bb>$c</FONT><FONT color=#007700>&lt;</FONT><FONT color=#0000bb>$num</FONT><FONT color=#007700>;&nbsp;++</FONT><FONT color=#0000bb>$c</FONT><FONT color=#007700>){ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</FONT><FONT color=#0000bb>$row&nbsp;</FONT><FONT color=#007700>==&nbsp;</FONT><FONT color=#0000bb>1</FONT><FONT color=#007700>) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$htmlOut&nbsp;</FONT><FONT color=#007700>.=&nbsp;</FONT><FONT color=#dd0000>"\t&lt;th&gt;"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$htmlOut&nbsp;</FONT><FONT color=#007700>.=&nbsp;</FONT><FONT color=#dd0000>"\t&lt;td&gt;"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$htmlOut&nbsp;</FONT><FONT color=#007700>.=&nbsp;</FONT><FONT color=#0000bb>$data</FONT><FONT color=#007700>[</FONT><FONT color=#0000bb>$c</FONT><FONT color=#007700>]; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</FONT><FONT color=#0000bb>$row&nbsp;</FONT><FONT color=#007700>==&nbsp;</FONT><FONT color=#0000bb>1</FONT><FONT color=#007700>) <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$htmlOut&nbsp;</FONT><FONT color=#007700>.=&nbsp;</FONT><FONT color=#dd0000>"&lt;/th&gt;\n"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$htmlOut&nbsp;</FONT><FONT color=#007700>.=&nbsp;</FONT><FONT color=#dd0000>"&lt;/td&gt;\n"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++</FONT><FONT color=#0000bb>$row</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$htmlOut&nbsp;</FONT><FONT color=#007700>.=&nbsp;</FONT><FONT color=#dd0000>"&lt;/tr&gt;\n"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$htmlOut&nbsp;</FONT><FONT color=#007700>.=&nbsp;</FONT><FONT color=#dd0000>"&lt;/table&gt;"</FONT><FONT color=#007700>;&nbsp;</FONT><FONT color=#ff8000>/*&nbsp;The&nbsp;HTML&nbsp;table&nbsp;is&nbsp;now&nbsp;ready*/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>fclose</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$csvFileHndl</FONT><FONT color=#007700>);&nbsp;&nbsp;&nbsp;</FONT><FONT color=#ff8000>/*&nbsp;Get&nbsp;rid&nbsp;of&nbsp;CSV&nbsp;file*/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/*&nbsp;Output&nbsp;a&nbsp;HTML&nbsp;file&nbsp;if&nbsp;needed&nbsp;*/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#007700>if(</FONT><FONT color=#0000bb>$htmlFilePath&nbsp;</FONT><FONT color=#007700>!=&nbsp;</FONT><FONT color=#0000bb>NULL</FONT><FONT color=#007700>){ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</FONT><FONT color=#0000bb>file_exists</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$htmlFilePath</FONT><FONT color=#007700>)){ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$errMsg&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#dd0000>"$htmlFilePath&nbsp;already&nbsp;exists.&nbsp;Overwriting&nbsp;file"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>errOut</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$errMsg</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>2</FONT><FONT color=#007700>); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(</FONT><FONT color=#0000bb>$htmlFileHndl&nbsp;</FONT><FONT color=#007700>=&nbsp;@</FONT><FONT color=#0000bb>fopen</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$htmlFilePath</FONT><FONT color=#007700>,</FONT><FONT color=#dd0000>"w"</FONT><FONT color=#007700>)){ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$htmlCode&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#dd0000>"&lt;html&gt;&lt;head&gt;&lt;title&gt;HTML&nbsp;Table&nbsp;of&nbsp;CSV&nbsp;file&nbsp;$csvFilePath&lt;/title&gt;&lt;/head&gt;&lt;body&gt;"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$endHtmlCode&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#dd0000>"&lt;/body&gt;&lt;/html&gt;"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(&nbsp;!&nbsp;@</FONT><FONT color=#0000bb>fwrite</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$htmlFileHndl</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$htmlCode</FONT><FONT color=#007700>)&nbsp;||&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;!&nbsp;@</FONT><FONT color=#0000bb>fwrite</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$htmlFileHndl</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$htmlOut</FONT><FONT color=#007700>)&nbsp;||&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;!&nbsp;@</FONT><FONT color=#0000bb>fwrite</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$htmlFileHndl</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>$endHtmlCode</FONT><FONT color=#007700>)){ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$errMsg&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#dd0000>"Output&nbsp;file&nbsp;write&nbsp;at&nbsp;$htmlFilePath&nbsp;could&nbsp;not&nbsp;be&nbsp;completed.&nbsp;Check&nbsp;disk&nbsp;space"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>errOut</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$errMsg</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>1</FONT><FONT color=#007700>); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}else{ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$errMsg&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#dd0000>"Output&nbsp;file&nbsp;$htmlFilePath&nbsp;could&nbsp;not&nbsp;be&nbsp;created.&nbsp;Check&nbsp;permissions"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>errOut</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$errMsg</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>1</FONT><FONT color=#007700>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>fclose</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$htmlFileHndl</FONT><FONT color=#007700>); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</FONT><FONT color=#0000bb>$htmlOut</FONT><FONT color=#007700>;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#ff8000>/*&nbsp;App&nbsp;ends&nbsp;after&nbsp;returning&nbsp;HTML&nbsp;code*/ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#007700>}else{ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$errMsg&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#dd0000>"Unable&nbsp;to&nbsp;open&nbsp;CSV&nbsp;file.&nbsp;Please&nbsp;check&nbsp;the&nbsp;file&nbsp;permissions&nbsp;or&nbsp;out&nbsp;of&nbsp;memory&nbsp;&lt;br&gt;&lt;b&gt;"&nbsp;</FONT><FONT color=#007700>.&nbsp;</FONT><FONT color=#0000bb>$csvFilePath&nbsp;</FONT><FONT color=#007700>.&nbsp;</FONT><FONT color=#dd0000>"&lt;/b&gt;"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>errOut</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$errMsg</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>0</FONT><FONT color=#007700>); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</FONT><FONT color=#0000bb>false</FONT><FONT color=#007700>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <BR>&nbsp;&nbsp;&nbsp;&nbsp;}else{ <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>$errMsg&nbsp;</FONT><FONT color=#007700>=&nbsp;</FONT><FONT color=#dd0000>"Unable&nbsp;to&nbsp;find&nbsp;input&nbsp;CSV&nbsp;file.&nbsp;Please&nbsp;check&nbsp;the&nbsp;file&nbsp;path&nbsp;&lt;br&gt;&lt;b&gt;"&nbsp;</FONT><FONT color=#007700>.&nbsp;</FONT><FONT color=#0000bb>$csvFilePath&nbsp;</FONT><FONT color=#007700>.&nbsp;</FONT><FONT color=#dd0000>"&lt;/b&gt;"</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT><FONT color=#0000bb>errOut</FONT><FONT color=#007700>(</FONT><FONT color=#0000bb>$errMsg</FONT><FONT color=#007700>,</FONT><FONT color=#0000bb>0</FONT><FONT color=#007700>); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</FONT><FONT color=#0000bb>false</FONT><FONT color=#007700>; <BR>&nbsp;&nbsp;&nbsp;&nbsp;} <BR><BR>} <BR></FONT><FONT color=#0000bb>?&gt; <BR></FONT></FONT></CODE> <TABLE width="100%" align=center bgColor=#6699cc> <TBODY> <TR> <TD align=middle><STRONG>Last modified: Saturday 03/February/2001</STRONG></TD></TR></TBODY></TABLE></BODY></HTML>