Error on sc_exec_sql

Dear all,

I’trying to use sc_exec_sql within a Php Type Button to execute the upload of a csv into a db table.
Just to learn how to do I’ve used a simple table .
My goal is to “append” new records coming from csv file into table. Here down the code and error.
Have you got idea how to solve it. Thanks Giovannino

sc_exec_sql("
LOAD DATA LOCAL INFILE ‘C:Tempwarehouse_sede.csv’
INSERT INTO
warehouse_sede
(codice, desbre, descri, name)
");

Errore

Errore durante l?accesso alla banca dati:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘INSERT INTO warehouse_sede (codice, desbre, descri, name)’ at line 1
LOAD DATA LOCAL INFILE ‘C:Tempwarehouse_sede.csv’ INSERT INTO warehouse_sede (codice, desbre, descri, name)

DB MySQL
TABLE warehouse_sede

fields
id-> autonumber
codice,
desbre,
descri,
name

Re: Error on sc_exec_sql

I dont know this syntax. You mean:
LOAD DATA LOCAL INFILE ‘DIR_TO_THE_FILE’ IGNORE
INTO TABLE mytable
FIELDS TERMINATED BY ’ ’ LINES TERMINATED BY ’
’ …

Not INSERT INTO …

Re: Error on sc_exec_sql

Dear Diogo,

I’ve tried the script into phpmyadmin SQL command and it works perfectly.

load data local infile ‘C:\Temp\warehouse_sede.csv’ IGNORE
into table warehouse_sede
fields terminated by ‘;’
(codice, desbre, descri, name)

into Scriptcase not. Have you got idea why ?

The error is the following
Errore

Errore durante l?accesso alla banca dati:
File ‘C:Tempwarehouse_sede.csv’ not found (Errcode: 2)
load data local infile ‘C:Tempwarehouse_sede.csv’ IGNORE into table warehouse_sede fields terminated by ‘;’ (codice, desbre, descri, name)

I’ve tried later editing path in such way
‘C:/Temp/warehouse_sede.csv’
and now it works !!!
Thanks
Giovannino

Re: Error on sc_exec_sql

Try to output an echo from the command before sending to sc_exec_sql, but, apparently is something with the slashs …

Its working … nice.