addslashes problem

From: Date: Fri, 08 Sep 2000 16:33:17 +0000
Subject: addslashes problem
Groups: php.general 
Request: Send a blank email to php-general+get-15905@lists.php.net to get a copy of this message
Addslashes problem... I can't see what's going wrong. I have a dos database with several hundred thousand records and I wrote a php script that will extract the info from the dbf and format it to load into an mysql table, using the usual php3 load type script ex: MySQL($dbName,"INSERT INTO xyz VALUES('1156','field1','field2','field3')"); contructed from a php3 script... fputs($fd, $prefix.trim(addslashes($record[0])).$s); fputs($fd, trim(addslashes($record[1])).$s); fputs($fd, trim(addslashes($record[2])).$s); fputs($fd, trim(addslashes($record[3])).$suffix."\r\n"); out of, say 100k records 30 may not load, what will not load are records that contain strings like Betty's, jim's or nation's...the addslashes above should escape the ' with \', which it does...however I get an error report from php3 for those records invalid escape sequence \' in record # and the records are not loaded. For the life of me I can't see where the problem is... ken

« previous php.general (#15905) next »