It's because when PHP finds the speech marks, it thinks the string ends there.. so you can put a backward slash infront of it to say "ignore this next speech mark"..
For example,
print "This is some "text with speech marks" that I want to print";
would return the error, I think the one you mentioned...
but if you had: -
print "This is some \"text with speech marks\" that I want to print";
Then it would work, as the \ tells PHP to ignore the "
So instead of you doing all that manually, add slashes would do it for you.. by entering your variable with the data such as this:
print addslashes("$myString");
Alternatively, I think this should also work.. as if you have a set of " marks.. whats inside is parsed.. but if you have a single one ' it is taken literally, as text..
print 'This is some "text with speech marks" that I want to print';