I'm trying to import data from a csv file into a blank database. I'm using a php script for that.

I'm not concerned about the security of the query at the moment, because I'm the only one using the script. I just created a small testing script for myself.

The csv file has duplicated items.

It won't insert anything, and the error log won't tell me anything.

This is my query:

```
        if ($data[16] != NULL) {
            $cursosViejos = ', '.$data[16];
        } else {
            $cursosViejos = '';
        }
        $x = $data[3];
        $importar = $conectar->prepare('
                INSERT INTO usuarios (
                    deprecated_userID,
                    deprecated_userName,
                    userEmail,
                    deprecated_userCursos,
                    deprecated_userRoles,
                    userApellido,
                    userDNI,
                    userDomicilioCalleyNumero,
                    userDomicilioLocalidad,
                    userEstadoCivil,
                    userEstudios,
                    userProfesion,
                    userTelefono,
                    deprecated_cuestionarioFinal,
                    userAnoticiado,
                    deprecated_entregaDoc
                )
                VALUES (
                ?,
                ?,
                ?,
                concat(?,?), 
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?,
                ?
                )
                ON DUPLICATE KEY UPDATE
                ');
            $importar->bindParam(1, $data[0]);
            $importar->bindParam(2, $data[1]);
            $importar->bindParam(3, $data[2]);
            $importar->bindParam(4, $x);
            $importar->bindParam(5, $cursosViejos);
            $importar->bindParam(6, $data[4]);
            $importar->bindParam(7, $data[5]);
            $importar->bindParam(8, $data[6]);
            $importar->bindParam(9, $data[7]);
            $importar->bindParam(10, $data[8]);
            $importar->bindParam(11, $data[9]);
            $importar->bindParam(12, $data[10]);
            $importar->bindParam(13, $data[11]);
            $importar->bindParam(14, $data[12]);
            $importar->bindParam(15, $data[13]);
            $importar->bindParam(16, $data[15]);
            $importar->bindParam(17, $data[17]);

        $ok = $importar->execute();

```

This is the table that will receive the data:

```
CREATE TABLE usuarios(
    userID int unsigned not null auto_increment primary key,
    userEmail char(50) null,
    userApellido char(50) null,
    userNombres char(20) null,
    userDNI char(15) null,
    userPass char(65) null,
    userFechaGeneracion char(25) null,
    userLastLogin char(25) NULL,
    userTelefono char(200) null,
    userCelular char(200) null,
    userDomicilioCalleyNumero char(100) null,
    userDomicilioLocalidad char(80) null,
    userDomicilioProvincia char(80) null,
    userProfesion char(180) null,
    userEstadoCivil char(80) null,
    userEstudios char(80) null,
    nacionalidad char(80) null,
    userAnoticiado char(80) null,
    docFoto char(100) null,
    docDNI char(100) null,
    docCertif char(100) null,
    docVerificada int(1) not null DEFAULT '0',
    comentariosAdmin text null,
    deprecated_userName char(50) null UNIQUE,
    deprecated_userID int(6) null,
    deprecated_userStatus int(6) null,
    deprecated_userNode int(6) null,
    deprecated_userRoles char(150) null,
    deprecated_userCursos varchar(7000) null,
    deprecated_entregaDoc char(150) null,
    deprecated_cuestionarioFinal char(150) null,
    userDatosPublicos text null,
    userTelsPublicos varchar(200) null DEFAULT NULL,
    UNIQUE(userEmail)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;

```

Is there any syntax error that I'm not seeing? Because other imports that I've done with the same script did worked.

Here's some sample data from the csv file:

> 
> "27","casia","mrcasia@yahoo.com.ar","","alumno\_presencial","CASIA,
>  María Rosa","","","","","","","","","","","",""
>  "28","alefrei","dralejandra@gmail.com","Curso Interdisciplinario On
>  Line de Administración de Consorcios","alumno\_online,
>  online1","","","","","","","","","","","","","" "57","Arq. Emilio
>  Gomez","eaos@yahoo.com","","autor","Arq. Emilio Fernando
>  Gómez","","","","","","","","","","","",""
>  "27","casia","mrcasia@yahoo.com.ar","","alumno\_presencial","CASIA,
>  María Rosa","","","","","","","","","","","",""
>  "27","casia","mrcasia@yahoo.com.ar","","alumno\_presencial","CASIA,
>  María Rosa","","","","","","","","","","","",""
> 
> 
> 

UPDATE:
-------

I've put the code in a try/catch and I have this error shown:

> 
> SQLSTATE[42000]: Syntax error or access violation: 1064
> 
> 
>