Solved

PHP Excel Query

Posted on 2002-05-21
7
386 Views
Last Modified: 2012-05-04
hello,
I'm very familiar with querying MS Access databases.  To this point I have had not problems.  I am being forced to query an Excel file now and am having countless problems.  I am using the following code to connect to the database:

$con = odbc_connect("datatest", "", "");

that works great!

when I attempt to query a datasheet named 'names' I get the following error:

Warning: SQL error: [Microsoft][ODBC Excel Driver] The Microsoft Jet database engine could not find the object 'names'. Make sure the object exists and that you spell its name and the path name correctly., SQL state S0002 in SQLExecDirect in c:\phpdev\www\connect2.php3 on line 4

it is able to connect to the excel database datatest so I know that the Excel datasource is working.

If anyone can provide the solution i'd be very greatful.

Nathan
0
Comment
Question by:phenixfilms
  • 2
7 Comments
 
LVL 4

Accepted Solution

by:
lokeshv earned 100 total points
ID: 7025891
cna u post ur code here ?

a alternate way....
http://www.phpclasses.org/browse.html/file/274.html

Lk
0
 
LVL 1

Author Comment

by:phenixfilms
ID: 7026129
<?
$con = odbc_connect("datatest", "", "");
$Query = "SELECT * FROM names";
$query_exe = odbc_do($con, $Query);
while(odbc_fetch_row($query_exe))
{
#for each of the records found#
print "Found a record<br>";
}

?>
0
 
LVL 40

Assisted Solution

by:RQuadling
RQuadling earned 100 total points
ID: 7026499
I've just tried setting up an ODBC Excel link via MSQuery.

It seems that you have to have Tables and System Tables turned on to be able to get to the sheets.

The names of the sheets I have are ...

Sheet1$,Sheet2$,Sheet3$ and a chart sheet called Sheet1$_

FOr me, only the first one has any data on it.

As the names include the $ at the end, what about adding that in your code?

Richard.
0
 
LVL 40

Expert Comment

by:RQuadling
ID: 11664829
My comments explain a bit towards getting the answer but no comments again.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now