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

Your name:

Reply:


Posted by Erwin Moller on 12/19/05 18:27

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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация