export for mySQL - problems with quotes

Any trouble you encounter with the Pedias, here's the place to ask for help.
Post Reply
simusch
Junior Member
Junior Member
Posts: 3
Joined: Sat Dec 11, 2004 11:09 am
Contact:

export for mySQL - problems with quotes

Post by simusch »

hi

i tried to write a template which writes sql-statements to insert into a database. so i can do a normal website, where my dvd's show up.

but i have the problem, that some " and ' are in the fields (summary or title or so)

this gives me problems with php...

i tried to replace them with " and ′ but if i replace the first sign, the second gives problems and reverse...

Code: Select all

$title = eregi_replace('"', '"', '[Key:Title]');
if there is a " in the title, it will be replaced. but if there is a ' in the title (like in she's) it gives me an error because of the used ' in the php-code...

is there some possibility to replace ' and " direct to ′ and " in the export-process? (like it does with ä,ö,ü,/,...)

thanks
simon
simusch
Junior Member
Junior Member
Posts: 3
Joined: Sat Dec 11, 2004 11:09 am
Contact:

Post by simusch »

anyone a tipp for me?
User avatar
Conor
Top Dog
Posts: 5344
Joined: Sat Jul 03, 2004 12:58 pm
Contact:

Post by Conor »

What I would do to solve the problem right away is write the template with a place holder for any ", such as MY_QUOTE. Then after the export do two search and replace operations, one for " to &quote and one for MY_QUOTE to ". If the export is not often then you can do this with BBEdit, otherwise you could automate it via Automator or the terminal. You can even use Automator to automate the export making the whole export, replace, upload, run in web browser, a simple one-click Automator action.

Final template would look like this:

Code: Select all

$title = MY_QUOTE[Key:Title]MY_QUOTE; 
Post Reply