tags:

views:

580

answers:

3

I'm getting the following error while running the SQL query given below

'Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression., SQL state 22005?T in SQLExecDirect in D:\xampp\htdocs\fypphp\functions.php on line 543'

INSERT INTO vehicle_log
(modem_ID, longitude, latitude, sattelite_strength, [timestamp], speed, Heading, Altitude, ReportID, Input, Output)
values
('$modem_id', '$longitude', '$latitude', '$satelite_str', '$timestamp', '$speed', '$heading', '$altitude', '$report_id', '$input', '$output')
A: 

You might need to convert one of your variables. What are your column types? Also try putting in some sample/test data to narrow down the problem.

OneSmartGuy
A: 

Are any of the fields numeric, like for example the ReportID? Then you should remove the apostrophes around the value.

Edit:
With latitude, longitude and sattelite strength as numeric, you should have:

INSERT INTO vehicle_log
(modem_ID, longitude, latitude, sattelite_strength, [timestamp], speed, Heading, Altitude, ReportID, Input, Output)
values
('$modem_id', $longitude, $latitude, $satelite_str, '$timestamp', '$speed', '$heading', '$altitude', '$report_id', '$input', '$output')

If timestamp is a date, you should have:

INSERT INTO vehicle_log
(modem_ID, longitude, latitude, sattelite_strength, [timestamp], speed, Heading, Altitude, ReportID, Input, Output)
values
('$modem_id', $longitude, $latitude, $satelite_str, #$timestamp#, '$speed', '$heading', '$altitude', '$report_id', '$input', '$output')
Guffa
tried that still doesn't work only latitude,longitude and sattelite strength are numeric
A: 

What are the datatypes of the variables and the datatypes of the fields in the table?

Incidentally, I'd fix the column with the word sattelite in it because of the misspelling if this is new development. This will drive you crazy over the years.

HLGEM