Re: odbc msaccess php5

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 5, 2008 at 11:04 AM, Bastien Koert <phpster@xxxxxxxxx> wrote:

>
>
> On Sat, Jul 5, 2008 at 6:51 AM, Peter Jackson <tasmaniac@xxxxxxxxxxxxxx>
> wrote:
>
>> Hi list,
>>
>>  I am trying to get info out of a MS Access 2000 db.  So far I have
>> managed to do some of it but current part has me stumped.
>>
>> Set up
>> Machine 1 - Debian 4, Apache, PHP5 unixodbc, mdbtools
>> Machine 2 - WindowsXP, MS-Access
>>
>> Database is in a windows share that is smfs mounted on the linux box.
>>
>> $conn=odbc_connect("Database","","");  works
>> $a = "abcd"; (this value exists in db)
>> $stat = "Select * FROM " . '"Table Name"';
>> $qry = odbc_exec($conn,$stat);
>> $res = odbc_result_all($qry) or die("Error: ");
>>
>> The above works as I expect it to.(Returns 70 rows)
>>
>> If I now want to add a where clause
>> $stat = "SELECT * FROM " . '"Table Name"' . " Where " . '"Column Name" =
>>  " . $a;  (This works)
>>
>> Now the place I fall into the abyss.
>> if I change WHERE clause in $stat to
>>  " WHERE " . '"Column Name"' LIKE abc*  (or other variations like abc%
>> "abc%" "abc*" 'abc%' 'abc*')
>> All I end up with is a blank page or Warning odbc_result_all No tuples
>> available at this result index.
>>
>> Also I'm having trouble working out how to use a date in the WHERE clause.
>>  I've tried #yy-mm-dd# yy-mm-dd* dd/mm/yy etc etc (oh and yy/mm/dd 00:00:00
>> etc
>>  I realize this is probably more odbc/sql related but after a lot of
>> goggling and reading I havent found the answer (about 5 days so far)
>> And before everyone shouts use mySQL postgresql etc that isnt an option at
>> this point in time. I dont need to update the records I just need to be able
>> to read them with php.
>>
>>  Oh and whilst I'm here is it possible to read an ms-query via odbc?
>> (eg select * from myquery). Just thinking that may fix one of my problems
>> (Caps and spaces in table/column names aaarrgghh)
>>
>> Peter Jackson
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> As the data seems to be text based, you need to quote it
>
> WHERE " . '"Column Name"' LIKE 'abc%'
>
> --
>
> Bastien
>
> Cat, the other other white meat



sorry, missed the access dates...

try mm/dd/yyyy as the format
-- 

Bastien

Cat, the other other white meat

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux