View Full Version : PHP MySQL and XML Help!

08-24-2009, 05:15 PM
I am having some issues. I am still learning on PHP and MySQL. I am a fast learner and taught myself how to parse a XML file to an array. What i have is trailer_spec['number']['tagname']. My XML file is layed out like so:

<Unit rec_id="124*4691">
<model>VSEBM03 16&apos;</model>
<lot_location>GOLDEN GAIT TRAILERS</lot_location>
<web_desc>Equipment Trailer with 4&apos; cleated fully adjustable ramps, 2 5/16&quot; ball hitch, diamond plat fenders, multi-leaf spring suspension, AL-Ko ultrulube axles w/brakes, electric brakes w/break-a-way kit, treated pine decking, and 4&quot; stake pockets.</web_desc>
<spec_detail>8 ft. 5 in.</spec_detail>
<spec_detail>TANDEM AXLE</spec_detail>

My PHP Code is now reading the Unit and puts the information into the array. I have many units around 300 to 400. I don't need to worry about the Spec node, i have to do that differently. I am just worried about the other ones right now. Some how when I take the code and read it into the array then pass it to a variable for the sql query it doesn't like the &apos; and &quot;. It gives me an error message. I think that it is reading them as quotes or apostorphes and putting them into the code and throwing the statement off to insert into the database. Is there anyone that can help me with this? I just don't know what to do. An example is at www.goldengait.com/testing/xml/ this is what my variable looks like that I am using in the sql_query($variable, $link); any help is helpful! Thank you!