Solved

PHP Excel Query

Posted on 2002-05-21
7
390 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:Richard Quadling
Richard Quadling 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:Richard Quadling
ID: 11664829
My comments explain a bit towards getting the answer but no comments again.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ajax to record click 3 24
Wordpress Query 5 42
PHP mail() function not working... 8 31
Php logic to add to date card 9 36
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

679 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