Re: FOLLOW UP on "column names not liked by odbc/php/access"

From: Date: Wed, 05 Dec 2001 11:21:31 +0000
Subject: Re: FOLLOW UP on "column names not liked by odbc/php/access"
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-76697@lists.php.net to get a copy of this message
hi, in your sql command there are several errors: it has the form INSERT INTO (<list of fieldnames>) VALUES (<list of values>); but: - there are more items in the list of values than in the list of fieldnames. these lists should match. - there's an extra comma after fieldname 'unico', and the closing ) is missing. - you dont need apostrophes for numeric fields. you get the table definition using sql command 'DESC tablename' (- and the tablename -was- missing :) hope this helps, michael "database,sql,query,table" mweb wrote: > > Hello, > > On the same database, this query works: > > $SQL_Exec_String = "INSERT INTO Multimedia (Titolo,Descrizione,Logo,Link) > VALUES ('prova titolo','prova descrizione','.gif','prova > link');"; > $cur= odbc_exec( $cnx, $SQL_Exec_String ); > > This one gives this error: > ISQL_exec_String = "Insert Into (Artista, Opera, Label, Anno, Nazione, CDNow, > Autore, AutoreNome, Genere, GenereCustom, SulWeb, Autorizzato, Unico, VALUES > ('prova2', 'inedita', 'ignota', > '2001','IT', 'nonesiste', 'io', > 'lui','3', 'ulteriori dettagli sul genere > musicale', 'http://www.no.it', '1', > '20011205111456', 'asdas erfver', 'ciao > ni', '2.5', 'Non andare a capo!');" > > Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Syntax error in > INSERT INTO statement., SQL state 37000 in SQLExecDirect in > C:\domini\m.net\inserzione3.php on line 115 > Error in odbc_exec( no cursor returned ) > > Does the second qyury look syntactically wrong to you? May it be that some > column name or quoting is wrong, or some value I try insert is not matching > the column type? If so, why would this be a *syntax* error? > > Is it possible to query access via Php so that it will tell the internal > strucure of the table? > (this database was developed and left online by somebody else, that's why > I don't have all this info) > > Any help is greatly appreciated, as are working sql statements for similar > (php+odbc+access) cases.

« previous php.general (#76697) next »