You shouldn't have to do anything: magic quotes puts the correct escape sequences in when receiving data via POST or GET, so that when you add it to the database you don't have to do anything special.
But when you retrieve the data, there should be only a single ' character there, and writing this to html for display should just result in a single ' also. So I'm confused about why this is happening. Are you perhaps passing the retrieved data from one script to the next via hidden variables before displaying it?