|
Posted by Jim Michaels on 02/24/06 04:09
"Richard Morton" <richard.e.morton@virgin.net> wrote in message
news:OZwpf.48347$uR.12605@newsfe7-gui.ntli.net...
> 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
mysql.com has their MySQL Migration Toolkit for Access databases. pretty
slick at converting them.
>
> This is the table.
> TableRowID - AutoNumber (auto_increment in MySQL)
> 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...
That statement really makes me want to see your function, because I suspect
you are trying to do something you can't do with a database resource. if
you are returning it, try returning a reference instead of the object
itself. I suspect the object is being destroyed after the end of the return
and possibly the connection is being closed because the local copy on the
stack is gone when the function finishes, and a copy is returned? I could
be wrong (someone correct me). I'm just making a guess.
can you do your processing within the function if nothing else works?
and... are you wanting to return the field names, or $db_resource? you
can't do anything without that, can you?
>
>
> 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
Bizarro.
>
>
>
> ideas?
>
> Thanks in advance
>
> Richard
Navigation:
[Reply to this message]
|