Ver Mensaje Individual
  #6 (permalink)  
Antiguo 26/06/2009, 09:54
Gaug
 
Fecha de Ingreso: junio-2009
Mensajes: 250
Antigüedad: 17 años, 4 meses
Puntos: 1
Respuesta: Problema de sintaxis con 'SELECT'.

Me surgió otro problema, tengo un while así:

Código PHP:
$data2=0;
while ((
$data = fgetcsv($handle, 4096, ',')) !== FALSE) {
$data = str_replace("'","''",$data);
if(
$data!=$data2){

$sintaxis=$data[0]."%";


  
$query_Recordset = "SELECT * from otratabla WHERE llave like '".$sintaxis."' order by llave ASC limit 0,1";
$Recordset = mysql_query($query_Recordset, $conex) or die(mysql_error());
$row_Recordset = mysql_fetch_assoc($Recordset);
$clave=$row_Recordset['llave'];
$data2=$data[0];
}

$import="INSERT into tabla(clave,campo2,campo3,campo4) values('$clave','$data[1]','$data[2]','$data[3]')";
$clave++;
$runq = mysql_query($import) or die(mysql_error());
echo 
$import;
echo 
"<br>";
} 
Y me marca éste error:
Código PHP:
Notice: Undefined offset: 1 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 2 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 3 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 4 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 5 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 6 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 7 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 8 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 9 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 10 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 11 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 12 in C:wampwwwsitiopruebacsv2.php on line 42

Notice
: Undefined offset: 13 in C:wampwwwsitiopruebacsv2.php on line 42 
La línea 42 es ésta:

Código PHP:
$import="INSERT into tabla(clave,campo2,campo3,campo4) values('$clave','$data[1]','$data[2]','$data[3]')"; 
Sin mencionar que pasa varias veces por el 'if', cuando sólo debería pasar la primera vez, o en caso de que cambie el valor de '$clave'
¿Qué es lo causa o cómo puedo resolverlo?

Gracias de antemano, saludos.