473,326 Members | 2,175 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Select problem with Apache, php4.3 and Jet 4.0 via ODBC on Win 2k/xp

Hi,

This is my first posting to this list, I guess a small intro should be
first, been developing in PHP for sometime, mainly with Mysql and nearly
always on Windows (oops, sorry).

I have done some bizarre things with PHP, but now I am involved in
re-writing an application (from ASP.NET).

The database however I can't change so easily as there are other
dependancies, and it's JET 4.0

This is the table.
TableRowID - AutoNumber
UCID - Text
TransactionTime - Date/Time

etc...

I have having trouble with getting any information out of it though...!

I can complete the following:

$db_resource = new accessDB();
$db_resource->host=$dbDSN;
$db_resource->username=$dbUsername;
$db_resource->open($dbPassword);

// build option list based on the field names in the table. Query is run
to just get the fieldnames
$query='SELECT * FROM TransTable'

$db_resource->query($query);
$db_resource->get_field_names();

and although the fieldnames are returned through my function, if I try
to extract the data from the query none is there...
if I add a where statement I get an error which I can't resolve:

SELECT * FROM TransTable WHERE ((TransactionTime>="2005-12-16 16:00:01")
AND (TransactionTime<="2005-12-21 16:00:00")) ORDER BY TableRowID

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 2., SQL state 07001 in
SQLExecDirect in c:\apache group\apache\htdocs\wmmc\db_access_class.inc
on line 58

ideas?

Thanks in advance

Richard
Dec 19 '05 #1
3 1586
Richard Morton wrote:
Hi,

This is my first posting to this list, I guess a small intro should be
first, been developing in PHP for sometime, mainly with Mysql and nearly
always on Windows (oops, sorry).

I have done some bizarre things with PHP, but now I am involved in
re-writing an application (from ASP.NET).

The database however I can't change so easily as there are other
dependancies, and it's JET 4.0

This is the table.
TableRowID - AutoNumber
UCID - Text
TransactionTime - Date/Time

etc...

I have having trouble with getting any information out of it though...!

I can complete the following:

$db_resource = new accessDB();
$db_resource->host=$dbDSN;
$db_resource->username=$dbUsername;
$db_resource->open($dbPassword);

// build option list based on the field names in the table. Query is run
to just get the fieldnames
$query='SELECT * FROM TransTable'

$db_resource->query($query);
$db_resource->get_field_names();

and although the fieldnames are returned through my function, if I try
to extract the data from the query none is there...
if I add a where statement I get an error which I can't resolve:

SELECT * FROM TransTable WHERE ((TransactionTime>="2005-12-16 16:00:01")
AND (TransactionTime<="2005-12-21 16:00:00")) ORDER BY TableRowID

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 2., SQL state 07001 in
SQLExecDirect in c:\apache group\apache\htdocs\wmmc\db_access_class.inc
on line 58

ideas?
If memory serves me well, access wants the most bizarre format for dates.
Try # instead of "

That might fix it.

Also, you might have a look at ADODB (www.phplens.com/adodb) and put that
inbetween.
Then use ADODB functions to do the formatting.
Also use it for stringliterals and such. Some database want ' to be
presented as \' others as '' etc.
ADODB will take care of that.

Nice extra feature is that next time you switch databsses, adodb will
figure it all out for you, you only need to change the database used in
adodb.

Regards,
Erwin Moller

Thanks in advance

Richard


Dec 19 '05 #2
Hi Erwin et al.

Thanks for that. However I am still one step back from there. Even if I
do the simplest of statements I can not get to the data.

'Select * from table'

I can't get to the data (I can however get the field names for some
reason so I am connected to the datasource). The _second_ time I try to
run the query I get the following:

Warning: odbc_execute(): SQL error: [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecute
in c:\apache group\apache\htdocs\wmmc\db_access_class.inc on line 59

To summarise:

The first time I run a query (even a simple one) it it is silent and I
can get field names but not any data.

The second time I run the query I get the above error.

Any ideas.

Rich

Erwin Moller wrote:
Richard Morton wrote:

Hi,

This is my first posting to this list, I guess a small intro should be
first, been developing in PHP for sometime, mainly with Mysql and nearly
always on Windows (oops, sorry).

I have done some bizarre things with PHP, but now I am involved in
re-writing an application (from ASP.NET).

The database however I can't change so easily as there are other
dependancies, and it's JET 4.0

This is the table.
TableRowID - AutoNumber
UCID - Text
TransactionTime - Date/Time

etc...

I have having trouble with getting any information out of it though...!

I can complete the following:

$db_resource = new accessDB();
$db_resource->host=$dbDSN;
$db_resource->username=$dbUsername;
$db_resource->open($dbPassword);

// build option list based on the field names in the table. Query is run
to just get the fieldnames
$query='SELECT * FROM TransTable'

$db_resource->query($query);
$db_resource->get_field_names();

and although the fieldnames are returned through my function, if I try
to extract the data from the query none is there...
if I add a where statement I get an error which I can't resolve:

SELECT * FROM TransTable WHERE ((TransactionTime>="2005-12-16 16:00:01")
AND (TransactionTime<="2005-12-21 16:00:00")) ORDER BY TableRowID

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 2., SQL state 07001 in
SQLExecDirect in c:\apache group\apache\htdocs\wmmc\db_access_class.inc
on line 58

ideas?

If memory serves me well, access wants the most bizarre format for dates.
Try # instead of "

That might fix it.

Also, you might have a look at ADODB (www.phplens.com/adodb) and put that
inbetween.
Then use ADODB functions to do the formatting.
Also use it for stringliterals and such. Some database want ' to be
presented as \' others as '' etc.
ADODB will take care of that.

Nice extra feature is that next time you switch databsses, adodb will
figure it all out for you, you only need to change the database used in
adodb.

Regards,
Erwin Moller

Thanks in advance

Richard


Dec 21 '05 #3
Richard Morton wrote:
Hi Erwin et al.

Thanks for that. However I am still one step back from there. Even if I
do the simplest of statements I can not get to the data.

'Select * from table'

I can't get to the data (I can however get the field names for some
reason so I am connected to the datasource). The _second_ time I try to
run the query I get the following:

Warning: odbc_execute(): SQL error: [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecute
in c:\apache group\apache\htdocs\wmmc\db_access_class.inc on line 59

To summarise:

The first time I run a query (even a simple one) it it is silent and I
can get field names but not any data.

The second time I run the query I get the above error.

Any ideas.
Hi

Try following an example that takes you through, step by step.
Look at www.php.net and look up odbc.

One thing you do wrong in your original code is that you do not store your
result somewhere:
$query='SELECT * FROM TransTable'

$db_resource->query($query);
$db_resource->get_field_names();


That is not good.

Try something like: $RS = $db_resource->query($query);

Then use $RS for looping.
But just look online and scout through the examples.

Good luck.
Regards,
Erwin Moller

Rich

Erwin Moller wrote:
Richard Morton wrote:

Hi,

This is my first posting to this list, I guess a small intro should be
first, been developing in PHP for sometime, mainly with Mysql and nearly
always on Windows (oops, sorry).

I have done some bizarre things with PHP, but now I am involved in
re-writing an application (from ASP.NET).

The database however I can't change so easily as there are other
dependancies, and it's JET 4.0

This is the table.
TableRowID - AutoNumber
UCID - Text
TransactionTime - Date/Time

etc...

I have having trouble with getting any information out of it though...!

I can complete the following:

$db_resource = new accessDB();
$db_resource->host=$dbDSN;
$db_resource->username=$dbUsername;
$db_resource->open($dbPassword);

// build option list based on the field names in the table. Query is run
to just get the fieldnames
$query='SELECT * FROM TransTable'

$db_resource->query($query);
$db_resource->get_field_names();

and although the fieldnames are returned through my function, if I try
to extract the data from the query none is there...
if I add a where statement I get an error which I can't resolve:

SELECT * FROM TransTable WHERE ((TransactionTime>="2005-12-16 16:00:01")
AND (TransactionTime<="2005-12-21 16:00:00")) ORDER BY TableRowID

Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 2., SQL state 07001 in
SQLExecDirect in c:\apache group\apache\htdocs\wmmc\db_access_class.inc
on line 58

ideas?

If memory serves me well, access wants the most bizarre format for dates.
Try # instead of "

That might fix it.

Also, you might have a look at ADODB (www.phplens.com/adodb) and put that
inbetween.
Then use ADODB functions to do the formatting.
Also use it for stringliterals and such. Some database want ' to be
presented as \' others as '' etc.
ADODB will take care of that.

Nice extra feature is that next time you switch databsses, adodb will
figure it all out for you, you only need to change the database used in
adodb.

Regards,
Erwin Moller

Thanks in advance

Richard



Dec 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pancho | last post by:
Greetings, I need help configuring/building PHP3 with MySQL as a DSO on a Solaris 8 box - this module is needed to host some existing sites I will be migrating Note. I built PHP4 from source and...
4
by: jimt | last post by:
what am i looking for. what libraries do i need to locate? etc... other than putting severe dents in my head and desk i dont seem to be making any headway. the libraries are so different from...
2
by: Brad Shinoda | last post by:
I've been running apache and PHP by using apt-get packages for a long time now, and it's been working fine for me. But the other day I tried to get image functions working and hit a brick wall with...
0
by: Kurt | last post by:
Hi, I tried to compile my php 4.3.9 with snmp support but it won't work. Compiling Net-SNMP always worked good --> I tried the 5.2rc4 and also the older version 5.1.2 successfully so far. I use...
2
by: John Murtari | last post by:
Folks, We are slow in rolling out PHP 5 to our users because it won't live as a module with PHP 4 in Apache 1.3.x/Linux. I have seen many workaround like running it as CGI or using a reverse...
3
by: bissatch | last post by:
Hi, I have recently installed PHP4 with Apache2. Currently I am trying to install the DOMXML extension. According to what I have read, if I uncomment the extension=php_domxml.dll line in php.ini...
4
by: Andy Baxter | last post by:
hello, I'm using the php4-mysql module with php4 under debian linux (sarge). I have a script, schedule.php, which runs fine when I invoke it from the command line, but fails with the error: ...
4
by: Chuck Anderson | last post by:
I am trying to install Php5 on my WindowsXP machine (at home, not on the 'net). I downloaded the Php Windows binary at php.net, unzipped it to c:/Php5, changed my Apache config file to use Php5...
7
by: jrefran | last post by:
Hi Everyone! Is there a need to compile my Apache 2.0.59 if I will use PHP4.4.5? How can I apply my Apache to PHP4.4.5 or I might ask how will I use my Apache properly with PHP4.4.5? This is...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.