I get the following errors when I run my script. It works fine with only 20
records, but at 100 I get errors.
"PHP has encountered an Access Violation at 00DA088E Warning: Unknown list
entry type in request shutdown (2) in
c:\www\htdocs\demos\ct.org\directory.php on line 0"
or
"PHP has encountered an Access Violation at 00DA088E "
Basically, I have a CSV file with about 3500 records (lines). I have a while
statement that goes through the file line by line. I am using fgetcsv().
While on a line I also open another file and search for a matching field
(CustomerID) and if it matches print the information on that line unless a
field in that file is set to "1".
This was initially tried using a query since this data is in a database.
That did not work. I exported the data into csv files. It worked in testing
limiting the amount of records to be displayed to less than 30. I just tried
it with limit set to 100 and that's when I got the problem.
Here is the code;
<?PHP
/* INFORMATION:
__ __
__/_/________________________________________\_\__
__|_ _|__
(___O) (O___)
(_____O) Christopher J. Crane (O_____)
(_____O) Web Designer (O_____)
(__O) I N X D E S I G N (O__)
| http://inxdesign.com |
| [EMAIL PROTECTED] |
| |
|__________________________________________________|
This script was created to help prepare the directory information, for the
Connecticut Technical Council for the Year 2002.
My Material - Please do not copy or modify it with checking with me first.
([EMAIL PROTECTED])
Please leave the INFORMATION banner in place.
*/
//==Global Definitions
//====================
define('SCRIPT_NAME', 'Connecticut Technology Council Directory Maker');
define('SCRIPT_VERSION', 'v1.0');
define('SCRIPT_CREATOR', '<a href="mailto:[EMAIL PROTECTED]">Christopher
J. Crane</a>');
define('CREATE_DATE', '08/06/02');
define('REVISED_DATE', '08/06/02');
$TestingMode = "On"; file://On or Off
$ShowCount = "10";
$row = 0;
print "<a name\"Top\"></a><b>Company Directory 2002</b><br>";
print "T e s t i n g M o d e - ";
if($TestingMode == "On") { print "On<br>Only Showing The First $ShowCount
Records.\n"; }
else { print "Off\n"; }
print "<a href=\"#end\">End</a>";
print "<hr align=\"left\" width=\"400\" hieght=1 noborder>\n";
//==C o m p a n y D a t a O u t p u t
//=======================================
$Data1 = fopen("Final.csv","r");
while ($Line1 = fgetcsv($Data1, 1000, ",")) {
$CompanyID = $Line1[0]; $CompanyName = $Line1[1]; $MemberTypeID =
$Line1[2];
$RevenueID = $Line1[3]; $Ownership = $Line1[4]; $NoPubRevenue =
$Line1[5];
$YearEstablished = $Line1[6]; $Exchange = $Line1[7]; $TotalEmployees =
$Line1[8];
$ConnEmployees = $Line1[9]; $Ticker = $Line1[10]; $Email = $Line1[11];
$Website = $Line1[12]; $IndustryID = $Line1[13]; $AddressTypeID =
$Line1[14];
$AddressLine1 = $Line1[15]; $AddressLine2 = $Line1[16]; $City =
$Line1[17];
$State = $Line1[18]; $Zip = $Line1[19]; $CountyName = $Line1[20];
$Profile = $Line1[21];
if($row != 0) {
print " <font size=4><b>$CompanyName</b></font><br>\n";
if($AddressLine1 != "") { print "$AddressLine1<br>\n"; }
if($AddressLine2 != "") { print "$AddressLine2<br>\n"; }
print "$City, $State $Zip<br>\n";
//==P h o n e D a t a O u t p u t
//===================================
$Data2 = fopen("PhoneTable.csv","r");
while ($Line2 = fgetcsv ($Data2, 1000, ",")) {
$CompanyID2 = $Line2[0]; $PhoneType = $Line2[1]; $AreaCode = $Line2[2];
$Prefix = $Line2[3]; $Suffix = $Line2[4];
if($CompanyID2 == $CompanyID) {
if($PhoneType == "Office") {
print "<b>Phone:
</b>($AreaCode)$Prefix-$Suffix "; }
}
}
fclose($Data2);
//==F a x D a t a O u t p u t
//===================================
$Data3 = fopen("PhoneTable.csv","r");
while ($Line3 = fgetcsv ($Data3, 1000, ",")) {
$CompanyID3 = $Line3[0]; $PhoneType = $Line3[1]; $AreaCode = $Line3[2];
$Prefix = $Line3[3]; $Suffix = $Line3[4];
if($CompanyID3 == $CompanyID) {
if($PhoneType == "FAX") {
print "<b>Fax:
</b>($AreaCode)$Prefix-$Suffix "; }
}
}
fclose($Data3);
print "<br>";
//==W e b s i t e / E m a i l D a t a O u t p u t
//==================================================
if(($Website != "") || ($Email != "[EMAIL PROTECTED]")) {
if($Website != "") { print "<b>Website: </b>$Website<br>\n"; }
if($Email != "[EMAIL PROTECTED]") { print "<b>E-Mail: </b>$Email<br>\n"; }
}
//==O w n e r s h i p D a t a O u t p u t
//===========================================
print "<b>Ownership: </b>";
if($Ownership == "1") { print "Private "; }
if($Ownership == "2") {
print "Public ";
if(!($Exchange == "OTHER" or $Exchange == "")) { print "($Exchange:
$Ticker) "; }
}
if($YearEstablished != "0") { print "<b>Est. </b>$YearEstablished"; }
print "<br>";
//==E m p l o y e e D a t a O u t p u t
//=========================================
print "<b>CT Emp: </b>";
if(($ConnEmployees >= 1) && ($ConnEmployees <= 9)) { print
"1-9 "; }
elseif(($ConnEmployees >= 10) && ($ConnEmployees <= 50)) { print
"10-50 "; }
elseif(($ConnEmployees >= 51) && ($ConnEmployees <= 100)) { print
"51-100 "; }
elseif(($ConnEmployees >= 101) && ($ConnEmployees <= 250)) { print
"101-250 "; }
elseif(($ConnEmployees >= 251) && ($ConnEmployees <= 500)) { print
"251-500 "; }
elseif($ConnEmployees >= 501) { print
"500+ "; }
if(($TotalEmployees >= 1) && ($TotalEmployees <= 50)) { print "<b>Tot Emp:
</b>1-50"; }
elseif(($TotalEmployees >= 51) && ($TotalEmployees <= 100)) { print "<b>Tot
Emp: </b>51-100"; }
elseif(($TotalEmployees >= 101) && ($TotalEmployees <= 500)) { print
"<b>Tot Emp: </b>101-500"; }
elseif($TotalEmployees >= 501) { print
"500+ "; }
print "<br>";
//==R e v e n u e D a t a O u t p u t
//=======================================
if($NoPubRevenue == 0) {
print "<b>Annual Revenue: </b>";
if($RevenueID == 1) { print "under 1 Million"; }
elseif($RevenueID == 2) { print "under 1 Million"; }
elseif($RevenueID == 3) { print "1-10 Million"; }
elseif($RevenueID == 4) { print "10-50 Million"; }
elseif($RevenueID == 5) { print "50-100 Million"; }
elseif($RevenueID == 6) { print "100-500 Million"; }
elseif($RevenueID == 7) { print "500 Million - 1 Billion"; }
elseif($RevenueID == 8) { print "1+ Billion"; }
else { print "NotAvailable"; }
print "<br>\n";
}
//==I n d u s t r y D a t a O u t p u t
//=======================================
print "<b>Industry: </b>";
if($IndustryID == 1) { print "Aircraft and Parts"; }
elseif($IndustryID == 1) { print "Aircraft and Parts"; }
elseif($IndustryID == 3) { print "Electronics and Components"; }
elseif($IndustryID == 4) { print "Electrical Equipment"; }
elseif($IndustryID == 5) { print "Other"; }
elseif($IndustryID == 6) { print "Measuring & Control Devices"; }
elseif($IndustryID == 7) { print "Medical Instruments"; }
elseif($IndustryID == 11) { print "Photonics/Optics/Imaging"; }
elseif($IndustryID == 12) { print "Advanced Materials and Chemicals"; }
elseif($IndustryID == 13) { print "Industrial Machinery and Appliances"; }
elseif($IndustryID == 14) { print "Application Integration & Middleware"; }
elseif($IndustryID == 15) { print "Application Software Development"; }
elseif($IndustryID == 16) { print "Application Service Provider"; }
elseif($IndustryID == 17) { print "Collaborative Commerce/Market Places"; }
elseif($IndustryID == 18) { print "IT Hosting/Infrastructure Mgmt"; }
elseif($IndustryID == 19) { print "Computer Office & Equipment"; }
elseif($IndustryID == 20) { print "Programming, Custom Dev., Professional
Services"; }
elseif($IndustryID == 22) { print "Multi-media, Online Marketing"; }
elseif($IndustryID == 23) { print "Customer Relationship Management"; }
elseif($IndustryID == 25) { print "Hardware and Devices"; }
elseif($IndustryID == 26) { print "Information Storage, Retrieval,
Security"; }
elseif($IndustryID == 28) { print "Prepackaged Software"; }
elseif($IndustryID == 29) { print "Retail and Information Services"; }
elseif($IndustryID == 30) { print "IT Consulting and Systems Design"; }
elseif($IndustryID == 31) { print "Safety Products"; }
elseif($IndustryID == 32) { print "Web Site Design"; }
elseif($IndustryID == 33) { print "Biotechnology"; }
elseif($IndustryID == 34) { print "Drugs/Pharmaceutical"; }
elseif($IndustryID == 35) { print "Research and Testing"; }
elseif($IndustryID == 36) { print "Cable, Communications Equip, Phone
Systems"; }
elseif($IndustryID == 37) { print "HR, Search, Training"; }
elseif($IndustryID == 38) { print "Internet Service Provider"; }
elseif($IndustryID == 39) { print "Wireless and Mobile"; }
elseif($IndustryID == 40) { print "Communications Services"; }
elseif($IndustryID == 41) { print "Business/Strategy Consulting"; }
elseif($IndustryID == 42) { print "Legal"; }
elseif($IndustryID == 43) { print "PR/Marketing"; }
elseif($IndustryID == 44) { print "Finance and Accounting"; }
elseif($IndustryID == 45) { print "Financial Services"; }
elseif($IndustryID == 46) { print "NFP, Association, State Agency"; }
elseif($IndustryID == 47) { print "Engineering Services"; }
elseif($IndustryID == 48) { print "Academic"; }
elseif($IndustryID == 49) { print "Energy"; }
print "<br>\n";
//==C o n t a c t D a t a O u t p u t
//=======================================
print "<b>Management:</b><br>\n";
$Data4 = fopen("CompleteContact.csv","r");
while ($Line4 = fgetcsv ($Data4, 1000, ",")) {
$CompanyID4 = $Line4[0]; $FirstName = $Line4[1]; $LastName = $Line4[2];
$DisplayTitle = $Line4[3]; $NoPubcontact = $Line4[4];
if($CompanyID4 == $CompanyID) {
if($NoPubcontact == "0") { print "$FirstName $LastName,
<i>$DisplayTitle</i><br>\n"; }
}
}
fclose($Data4);
file://==P r o f i l e D a t a O u t p u t
//=======================================
if($row != 0) {
if($Profile != "") { print "<b>Profile:</b><br>$Profile<br>\n"; }
}
//==End of Loop!
//=======================================
}
$row++;
print "<br>\n";
if($TestingMode == "On") { if($row == $ShowCount) { break; } }
}
fclose($Data1);
print "<pre>
===============
---- Done! ----
===============
</pre>
<b>Script Name:</b> " . SCRIPT_NAME . " " . SCRIPT_VERSION . "<br>\n
<b>Script Created By:</b> " . SCRIPT_CREATOR . "<br>\n
<b>Created On:</b> " . CREATE_DATE . "<br>\n
<b>Revised On:</b> " . REVISED_DATE . "\n";
print "<pre>
__ __
__/_/________________________________________\_\__
__|_ _|__
(___O) (O___)
(_____O) Christopher J. Crane (O_____)
(_____O) Web Designer (O_____)
(__O) I N X D E S I G N (O__)
| http://inxdesign.com |
| [EMAIL PROTECTED] |
| |
|__________________________________________________|
</pre><a name=\"End\"></a><a href=\"#Top\">Top</a>\n\n";
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php