Dave M G wrote:
PHP List, MySQL List
In my PHP environment, I have "Magic Quotes" turned off, and I use the
mysql_real_escape_string() function clean strings of SQL syntax before
inserting them into my database.
So the data stored in my database does not have escape characters in
it. Particularly, double and single quotes don't have slashes in front
of them.
This seems to work fine so long as I'm reading data into and out of
the database from within my scripts.
However, when I backup and import databases - I use the phpMyAdmin
interface - they have escape slashes in front of every double and
single quote characters. I'm not sure if it's on the export or import
where they get added in.
It probably depends on what you mean by "exporting"...if you do a select
* into outfile it might remove them. If you're doing a mysql dump, it
will add them because it's constructing sql statements, and they have
to be escaped.
I would take phpMyAdmin out of the equation and just use mysqldump. You
should have no problem doing something like creating a scratch table,
dumping it, and re-importing from the dump.
mysql> create table B like table A;
mysql> insert into table B select * from A where c like "%'%" limit 10;
bash$ mysqldump --opt frumble B > b.sql
bash$ mysql -u -p frumble < b.sql
This should replace table B in database frumble without incident. If
you're having trouble importing a mysql dump using phpMyAdmin, it might
be simpler not to use it, and use mysqldump instead.
HTH
Jed
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php