Solved

PHP Excel Query

Posted on 2002-05-21
7
388 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

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…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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 dynamically set the form action using jQuery.

813 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

13 Experts available now in Live!

Get 1:1 Help Now