Re: duda MySQL

From: Date: Fri, 01 Jul 2005 10:54:55 +0000
Subject: Re: duda MySQL
References: 1 2  Groups: php.general.es 
Request: Send a blank email to general-es+get-55265@lists.php.net to get a copy of this message
teneis razón... tengo que 'escapear' las comillas y todo eso... $sql = 'LOAD DATA LOCAL INFILE ''/ruta/al/documento.txt'' INTO TABLE productos FIELDS TERMINATED BY ''\\t'' ENCLOSED BY ''"'' ESCAPED BY ''\\\\'' LINES TERMINATED BY ''\\n'''; Ahora lo que tengo es un error en el codigo PHP: Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /docroot/nuevaweb/functions.php on line 213 (la linea 213 es donde está el '$sql= ...') wes ··· Wessley Roche · Icon Designer · wessley@iconizer.com · www.iconizer.com ··· On Jul 1, 2005, at 12:30 PM, Juan Francisco Giordana wrote:
Wessley Roche wrote: 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 ''' at line 2 ¿Qué estoy haciendo mal?
Creo que el error te lo esta tirando porque PHP esta interpretando los caracteres \t, \n, etc. echo $sql que te devuelve??? Proba usando comillas simples. $sql = 'LOAD DATA LOCAL INFILE \'/ruta/al/documento.txt\' INTO TABLE \'productos\` FIELDS TERMINATED BY \'\t\' ESCAPED BY \'\\' LINES TERMINATED BY \'\n\''; mysql_query($sql) or die('<br><br>'.mysql_error()); Saludos --Juan Francisco Giordana Homepage: http://www.juangiordana.com.ar Linux registered user 294733 --PHP Spanish Localization Talk Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general.es (#55265) next »