0

I am trying to insert a new line in Ms Access.

The fields are the following

Design

And this is my query

 $query = "INSERT INTO [Meldungen] VALUES ('',".$_SESSION['Firma_Index'].",'01.01.2001',".$password.",".$password.",".$password.",".$password.",".$password.",".$password.",".$password.",0,'Internet')";

I always get mismatch of data type SQL state 22005. But I already deleted the '-s for the number things and text still got the ''. Any idea? God, I hate this cryptic error messages.

Liam Schnell
  • 474
  • 8
  • 25

1 Answers1

0

Literal date values in MS Access (technically, the Jet/ACE db engine) must be enclosed in # signs, not double or single quotes. Also, Access interprets periods (.) as time separators, not date separators. I believe it disregards regional settings when doing this, though, admittedly, I'm not sure.

Try the following instead:

$query = "INSERT INTO [Meldungen] VALUES ('',".$_SESSION['Firma_Index'].",#01/01/2001#,".$password.",".$password.",".$password.",".$password.",".$password.",".$password.",".$password.",0,'Internet')";
Community
  • 1
  • 1
mwolfe02
  • 23,787
  • 9
  • 91
  • 161