PHP and MSACCESS

admin

Administrator
Staff member
Hi!
I've PHP set up running as an Apache module. I have a database with two tables in MSACCESS 2000. I can perform SELECT's on the tables and extract information the thing is when I try to insert.

Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement., SQL state 37000 in SQLExecDirect in c:/intranet/web21/sitemsg.php on line 53

where line 53 corresponds to
$result = odbc_exec($connection, $query);

I tried the insert statement in three different ways and both returned the same error

$sql1="INSERT INTO sitemsg SET Index=$index,Data=$sys_date,Tipo de Mensagem=$tipo,Nome=$snd_name,E-mail=$snd_mail,Mensagem=$subject)";

$query = "INSERT INTO sitemsg ";
$query .= "(Index,Data, Tipo de Mensagem, ";
$query .= "Nome, E-mail, Mensagem) ";
$query .= "values('$index', '$sysdate', '$tipo', '$snd_name', '$snd_email', '$subject')";

$sql2="INSERT INTO sitemsg VALUES($index,$sys_date,$tipo,$snd_name,$snd_mail,$subject)";


Can you please give me an hint?
Thanks in advance

Arabela
 
Back
Top