Solved

INSERT data into MYSQL

Posted on 2011-02-23
6
280 Views
Last Modified: 2012-05-11
This has to be simple but i am baffled not to find anything on this matter  

I have this string, yes it's a string, not a file. And i want to insert it into my sql without any modification.
mysql_escape_string() does not work;
mysql_real_escape_string() does not work



<root>
                        <supplorder entrydate="23/02/2011">
                          <lineitems>
           <lineitem>
            <art_nr>20673</art_nr>
            <lev_num>20001</lev_num>
            <code_lev>15-00155</code_lev>
            <eenheid>5</eenheid>
            <werkeenheid>5</werkeenheid>
            <nr_eenheden>1</nr_eenheden>
            <omschr>huls iso 0.14mm2  grijs zak 500</omschr>
            <omschrlang></omschrlang>
            <internrem></internrem>
            <aank>8.59</aank>
            <voor>0</voor>
            <besteld>5</besteld>
            <lijntot>42.94</lijntot>
            <kortbijlev>0</kortbijlev>
            <eenhstr>st</eenhstr>
            <vrij_ingav>0</vrij_ingav>
            <assocrekrowid>0</assocrekrowid>
          </lineitem>
         
           <lineitem>
            <art_nr>20675</art_nr>
            <lev_num>20001</lev_num>
            <code_lev>15-00255</code_lev>
            <eenheid>5</eenheid>
            <werkeenheid>5</werkeenheid>
            <nr_eenheden>1</nr_eenheden>
            <omschr>huls iso 0.25mm2  geel zak 500</omschr>
            <omschrlang></omschrlang>
            <internrem></internrem>
            <aank>6.64</aank>
            <voor>2</voor>
            <besteld>3</besteld>
            <lijntot>19.91</lijntot>
            <kortbijlev>0</kortbijlev>
            <eenhstr>st</eenhstr>
            <vrij_ingav>0</vrij_ingav>
            <assocrekrowid>0</assocrekrowid>
          </lineitem>
         </lineitems>
               </supplorder>
           </root>
0
Comment
Question by:ScottNL1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 34960498
Post your INSERT INTO statement please
0
 
LVL 34

Expert Comment

by:Beverley Portlock
ID: 34960500
Also the table definition as well so we can see the column's data type and size
0
 
LVL 3

Expert Comment

by:jmsloan
ID: 34960523
Your double quotes need to be backslashed

insert into test values('<root>
<supplorder entrydate=\"23/02/2011\">
<lineitems>
<lineitem>
<art_nr>20673</art_nr>
<lev_num>20001</lev_num>
<code_lev>15-00155</code_lev>
<eenheid>5</eenheid>
<werkeenheid>5</werkeenheid>
<nr_eenheden>1</nr_eenheden>
<omschr>huls iso 0.14mm2 grijs zak 500</omschr>
<omschrlang></omschrlang>
<internrem></internrem>
<aank>8.59</aank>
<voor>0</voor>
<besteld>5</besteld>
<lijntot>42.94</lijntot>
<kortbijlev>0</kortbijlev>
<eenhstr>st</eenhstr>
<vrij_ingav>0</vrij_ingav>
<assocrekrowid>0</assocrekrowid>
</lineitem>

<lineitem>
<art_nr>20675</art_nr>
<lev_num>20001</lev_num>
<code_lev>15-00255</code_lev>
<eenheid>5</eenheid>
<werkeenheid>5</werkeenheid>
<nr_eenheden>1</nr_eenheden>
<omschr>huls iso 0.25mm2 geel zak 500</omschr>
<omschrlang></omschrlang>
<internrem></internrem>
<aank>6.64</aank>
<voor>2</voor>
<besteld>3</besteld>
<lijntot>19.91</lijntot>
<kortbijlev>0</kortbijlev>
<eenhstr>st</eenhstr>
<vrij_ingav>0</vrij_ingav>
<assocrekrowid>0</assocrekrowid>
</lineitem>
</lineitems>
</supplorder>
</root>'):
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 14

Expert Comment

by:Scott Madeira
ID: 34960542
what do you mean "mysql_escape_string() does not work;
mysql_real_escape_string() does not work"

Do you get an error message? Is the data not what you were expecting?  Please provide the SQL statement and table definition that was requested above for us to help you.
0
 
LVL 1

Accepted Solution

by:
ScottNL1 earned 0 total points
ID: 34960721
unbelievable, after all that i forgot to put the $string in quoit's.

INSERT INTO drafts (id,xml) VALUES ($id,'$string')

sorry for that,  
0
 
LVL 1

Author Closing Comment

by:ScottNL1
ID: 34995334
I am a fool
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question