Parsing XML
Date: 11/03/07
(PHP Community) Keywords: xml, sql
I'm having some problems parsing an XML file. For instance, I have a tag that looks like this:
ANONYMOUS: Hors envyeux, retirez vous d'ici
The function that reads the data from the tag assembles an SQL statement out of all the various tags. The code for this TITLE tag looks like this:
$SQL.= 'and title="'.$data.'" ';
If the data contains " it parses fine, since the data is surrounded with single quotes, but when ' comes through, it truncates the string.
As I write all this out and think about the problem, my initial idea is to check the $data for either " or ' and then use a properly formatted SQL statement for the corresponding single or double quote. Anyone have a better idea?
Thanks
Source: http://community.livejournal.com/php/593589.html