6 Replies - 1905 Views - Last Post: 14 April 2013 - 10:18 AM Rate Topic: -----

#1 Roemeo  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 153
  • Joined: 08-December 08

Fatal error: Class 'COM' not found in

Posted 14 April 2013 - 09:37 AM

Hello ,

I am new to php and working on school work to connect an access database to a php form when i try to connect using easy php i get an error "Fatal error: Class 'COM' not found in" any suggestions as to how i can go a bout fixing this

this is the code im using

$conn = new COM('ADODB.Connection') or exit ('Cannot start ADO'); 
	$$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");
	$sql = 'INSERT into tblVendors values (vendorNo, vendorName, address1, city, provState, postalZip, country, phone, FAX)'; 
	$rs = $conn->Execute($sql); 


Is This A Good Question/Topic? 0
  • +

Replies To: Fatal error: Class 'COM' not found in

#2 Dormilich  Icon User is online

  • 痛覚残留
  • member icon

Reputation: 3576
  • View blog
  • Posts: 10,442
  • Joined: 08-June 10

Re: Fatal error: Class 'COM' not found in

Posted 14 April 2013 - 09:42 AM

what OS does your server use?
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3809
  • View blog
  • Posts: 13,517
  • Joined: 12-December 12

Re: Fatal error: Class 'COM' not found in

Posted 14 April 2013 - 09:45 AM

Have your referred to the docs? Read the requirements and installation instructions.
Was This Post Helpful? 1
  • +
  • -

#4 Roemeo  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 153
  • Joined: 08-December 08

Re: Fatal error: Class 'COM' not found in

Posted 14 April 2013 - 09:48 AM

View PostDormilich, on 14 April 2013 - 10:42 AM, said:

what OS does your server use?


im using windows 7 ultimate

View Postandrewsw, on 14 April 2013 - 10:45 AM, said:

Have your referred to the docs? Read the requirements and installation instructions.


ive tried that and then it loads and resets

This post has been edited by Roemeo: 14 April 2013 - 09:52 AM

Was This Post Helpful? 0
  • +
  • -

#5 Roemeo  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 153
  • Joined: 08-December 08

Re: Fatal error: Class 'COM' not found in

Posted 14 April 2013 - 10:08 AM

Posted all code incase there is another issue i am not aware of that is stopping me from loading

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>
Verification Confirmed
</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
	
</head>
<body>
<fieldset>
<?php
    $id = $_POST['txtIdNumber'];
	$vendName = $_POST['txtVendName'];
	$addy = $_POST['txtAddy'];
	$city = $_POST['txtCity'];
	$prov = $_POST['txtProv'];
	$postal = $_POST['txtPostal'];
	$country = $_POST['txtCountry'];
	$phoneNumber = $_POST['txtPhoneNumber'];
	$faxN = $_POST['txtFaxN'];
	$db = 'C:\\Program Files (x86)\\EasyPHP-12.1\\www\\Assignment5PHP\\As4aStudent.mdb'; 
	$conn = new COM('ADODB.Connection') or exit ('Cannot start ADO'); 
	$$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");
	$sql = 'SELECT vendorNo, vendorName, address1, city, provState, postalZip, country, phone, FAX  FROM tblVendor ORDER BY vendorName”; '; 
	$rs = $conn->Execute($sql); 
		
		if (!$id)
		{
		echo "ID Number Can Not Be Empty";
		}
		else
		{
			echo  "ID: " ,  $id , "<br>"; 
			$rs->Fields['vendorNo']->$id;
		}
		if (!$vendName)
		{
			echo "Vendor Name Can Not Be Empty";
		}
		else
		{
			echo  "Vendor Name: " ,  $vendName , "<br>"; 
			$rs->Fields['vendorName']->$vendName;			
		}
		if (!$addy)
		{
			echo "Address Can Not Be Empty";
		}
		else
		{
			echo  "Address: " , $addy , "<br>"; 
			$rs->Fields['address1']->$addy;		
		}
		if (!$city)
		{
			echo "City Can Not Be Empty";
		}
		else
		{
			echo  "City: " ,  $city , "<br>"; 
			$rs->Fields['city']->$city	;		
		}
		if (!$prov)
		{
			echo "Province Can Not Be Empty";
		}
		else
		{
			echo  "Province: " ,  $prov , "<br>"; 	
			$rs->Fields['provState']->$prov ;
		}
		if (!$postal)
		{
			echo "Postal Number Can Not Be Empty";
		}
		else
		{
			echo  "Postal Code: " ,  $postal , "<br>"; 
			$rs->Fields['postalZip']->$postal;
			
		}
		if (!$country)
		{
			echo "Country Can Not Be Empty";
		}
		else
		{
			echo  "Country: " ,  $country , "<br>";
			$rs->Fields['country']->$country;
		}
		if (!$phoneNumber)
		{
			echo "Phone Number Can Not Be Empty";
		}
		else
		{
			echo  "Phone Number: " ,  $phoneNumber , "<br>"; 
			$rs->Fields['phone']->$phoneNumber;
		}
		if (!$faxN)
		{
			echo "Fax Number Can Not Be Empty";
		}
		else
		{
			echo  "Fax Number: " ,  $faxN , "<br>";
			$rs->Fields['FAX']->$faxN;
		}
		$rs->Close(); 
		$conn->Close(); 
		$rs = null; 
		$conn = null; 
	?>
	
	<br />
	<div id = "buttons">
<input type="button" value="Return To Main Menu" class="myButton" style="height: 50px; width: 220px"; onclick="location.href='index.html'">
<br />
</div>
</fieldset>
</body>
</html>

Was This Post Helpful? 0
  • +
  • -

#6 andrewsw  Icon User is online

  • It's just been revoked!
  • member icon

Reputation: 3809
  • View blog
  • Posts: 13,517
  • Joined: 12-December 12

Re: Fatal error: Class 'COM' not found in

Posted 14 April 2013 - 10:13 AM

Quote

ive tried that and then it loads and resets

Not sure what this means..

If you receive the same 'COM not found' error then the error is not in your code, but in installing, or referencing, the COM library.
Was This Post Helpful? 1
  • +
  • -

#7 Roemeo  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 153
  • Joined: 08-December 08

Re: Fatal error: Class 'COM' not found in

Posted 14 April 2013 - 10:18 AM

thank you everyone I have no found my error appreciate all the help andrewsw is correct use that guide. I made a mistake and had two $ beside my connection sorry
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1