Forum Moderators: coopster

Message Too Old, No Replies

connecting to an Access data base

how do u do it?

         

flying monkey

9:05 pm on Nov 23, 2003 (gmt 0)

10+ Year Member



i want to connect to a Access data base but dont know how to do it. also how would u add more rows if needed and how would u write to the cells in the tables.

coopster

7:15 pm on Dec 1, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Hey, flying_monkey, I forgot to tell you,
congratulations!
...and thanks for the update regarding solving your permissions issue.

Regards -- coopster

flying monkey

10:21 pm on Dec 1, 2003 (gmt 0)

10+ Year Member



lol........thanks but thanks u for helping me out through all this

flying monkey

11:21 pm on Dec 1, 2003 (gmt 0)

10+ Year Member



well this is what i have:

$cnx = odbc_connect( 'test' , '', '');
if (!$cnx) {
Error_handler( odbc_errormsg() , $cnx );
}

$SQL_Exec_String = "Delete From People Where ID = '$id'";
$cur= odbc_exec( $cnx, $SQL_Exec_String );
if (!$cur) {
Error_handler( odbc_errormsg() , $cnx );
}

odbc_close( $cnx);

but it does not work...i get an error message saying:
"[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression."

coopster

11:53 pm on Dec 1, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I'll bet your $id variable is empty, and MS Access is picky about that. Before you try to execute your odbc_exec function, print out the $id variable to see what it contains. Message # 9 in this thread explains how to exit() and print the sql statement out for debugging.

flying monkey

2:47 am on Dec 2, 2003 (gmt 0)

10+ Year Member



it returns the number that i want to delete.

flying monkey

3:07 am on Dec 2, 2003 (gmt 0)

10+ Year Member



you have:
$SQL_Exec_String = "Delete From People Where ID = '$id'";

since $id is in single quotes access thinks you are giving it a character variable instead of a numeric one like it is in the database. Hence type mismatch.

try:
$SQL_Exec_String = "Delete From People Where ID = $id";

this seggestion seemed to work.

flying monkey

3:07 am on Dec 2, 2003 (gmt 0)

10+ Year Member



thanks to figment88

ergophobe

10:02 pm on Dec 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have a related question [webmasterworld.com], which I posted in the Web Tech forum, but from the other end. I have an Access DB that runs on workstations and users currently use local "replicas" and then synchronize periodically. The idea is to put it on the web and I'm wondering whether to try to set up an "all Microsoft" solution or build a PHP interface (in which case I would simply convert the DB to MySQL). The problem is that I just don't have a clue about MS database servers and how an Access frontend interacts with them and all that.

Anyway, I have more details in that thread [webmasterworld.com] and would certainly welcome any insight anyone might have.

Tom

This 38 message thread spans 2 pages: 38