?
Solved

INSERT data into MYSQL

Posted on 2011-02-23
6
Medium Priority
?
282 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
Independent Software Vendors: 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

765 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