使用php将mysql数据保存到sql文件,准备导入到sqlite中

I have a script that generates a sql file from the data saved in a mysql database. The data is stored in the mysql database without any added slashes. This all works fine except for quotes. If there is a quote in the mysql data then the file is generated, but it wont then insert the data into sqlite. I have tried adding slashes to the data that is extracted and put into the sql file, but this doesn't work.. Is there a correct procedure to do this, or a better way to get data from mysql into sqlite?

Why not dump the data via mysql itself rather than PHP code? http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html