Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

php for local MS Access mdb containing local table and linked table

Status
Not open for further replies.

hovercraft

Technical User
Jun 19, 2006
236
US
I can connect to a local mdb via PDO. I can access data contained in the local table in the local mdb. What I can't seem to do is to access data contained in a linked table in the same mdb. The linked table actually resides on another server but I am able to link to it via a network drive or fully qualified name.
Any help would help a heap!

PHP:
<?php

	echo "This is before the odbc happens <br />";

try{

$dbName = "D:\\Websites\\thisismysite.net\\test.mdb";
$db = new PDO("odbc:DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=$dbName; Uid='Admin'; Pwd='';"); 
 	
	$sql  = "SELECT * FROM Tickets1";  

	$sql .= " WHERE TicketLastName = 'SMITH'";  
    
//	 $sql  = "SELECT * FROM tbl_names";  

//	 $sql .= " WHERE lastname = 'SMITH'"; 
		$result = $db->query($sql);  
echo "test - before while";
		while ($row = $result->fetch())
		{
		echo "test - in while";
$LastName = $row["TicketLastName"];
//$LastName = $row["lastname"];
	echo "hello ";

echo $LastName;	} 
		
	}

catch (PDOException $e)
		{
			print "ERROR: " . $e->getMessage(). "<br/>";
			//die();
		}
			      
echo "<br />This is after the odbc happens";
	
 ?>

The comments are the parts I've been using to toggle back and forth between the local table and the linked table. I do not recieve an error with the linked table, just no data and the code seems to stop without echoing "this is after the odbc happens"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top