php to access database fatal error message?

fatal error Uncaught exception 'com_exception' with message

Page 1 of 1

2 Replies - 8447 Views - Last Post: 14 April 2009 - 11:43 PM Rate Topic: -----

#1 XMEGA  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 135
  • Joined: 17-November 08

php to access database fatal error message?

Posted 14 April 2009 - 06:17 PM

trying to connect from javascript html to php to access database having issues at php to access part with the following error message

Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft JET Database Engine<br/><b>Description:</b> Not a valid file name.' in D:\Program Files\xampplite\htdocs\RCassign4partsform.php:39 Stack trace: #0 D:\Program Files\xampplite\htdocs\RCassign4partsform.php(39): com->Open('Provider=Micros...') #1 {main} thrown in D:\Program Files\xampplite\htdocs\RCassign4partsform.php on line 39

what it fully prints is the following the error just appears at the bottom, does not add to the database also

Vendor ID: 2014
Item Description: QQQQQQ
On Hand: 1
On Order: 1
Cost: $1
List Price: $11
Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft JET Database Engine<br/><b>Description:</b> Not a valid file name.' in D:\Program Files\xampplite\htdocs\RCassign4partsform.php:39 Stack trace: #0 D:\Program Files\xampplite\htdocs\RCassign4partsform.php(39): com->Open('Provider=Micros...') #1 {main} thrown in D:\Program Files\xampplite\htdocs\RCassign4partsform.php on line 39

using...
<html>
<head>
<title>Parts Form</title>
</head>
<body>

<?php
	$vendorID = $_POST["vendorID"];
	$itemDescription = $_POST["itemDescription"];
	$onHand = $_POST["onHand"];
	$onOrder = $_POST["onOrder"];
	$cost = $_POST["cost"];
	$listPrice = $_POST["listPrice"];

	print ("<br> Vendor ID: $vendorID");
	print ("<br> Item Description: $itemDescription");
	print ("<br> On Hand: $onHand");
	print ("<br> On Order: $onOrder");
	print ("<br> Cost: $$cost");
	print ("<br> List Price: $$listPrice");

	$db="D:\Program_Files\xampplite\htdocs\As4.mdb";
	$conn=new COM('ADODB.Connection');

	$conn->Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=$db");

	$sql="INSERT INTO Parts(VendorNo,Description,OnHand,OnOrder,Cost,ListPrice)
	VALUES('$vendorID','$itemDescription','$onHand','$onOrder','$cost','$listPrice')";

	$rs=$conn->Execute($sql);
?>

</body>
</html>


This post has been edited by XMEGA: 14 April 2009 - 06:30 PM


Is This A Good Question/Topic? 0
  • +

Replies To: php to access database fatal error message?

#2 no2pencil  Icon User is online

  • Head MFIC
  • member icon

Reputation: 5063
  • View blog
  • Posts: 26,440
  • Joined: 10-May 07

Re: php to access database fatal error message?

Posted 14 April 2009 - 06:23 PM

** Moved to PHP **
Was This Post Helpful? 0
  • +
  • -

#3 Valek  Icon User is offline

  • The Real Skynet
  • member icon

Reputation: 541
  • View blog
  • Posts: 1,708
  • Joined: 08-November 08

Re: php to access database fatal error message?

Posted 14 April 2009 - 11:43 PM

In your assignment of $db, try escaping the backslashes in the file path. So for every backslash (\), make it two (\\).
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1