SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot daveporter's Avatar
    Join Date
    Mar 2002
    Location
    Perth, Western Australia
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    importing html into mysql field

    Hi there,

    I'm importing data into a mySQL database using PHP and one field is a description field, which contains HTML.

    It all works OK apart from the fact that all the double quotes are coming out wierd. Such as:
    table width=&#34450&#34

    How can I stop this happening. The raw data is generated from a Windows APP.

    TIA - Dave Porter

  2. #2
    SitePoint Addict Chillijam's Avatar
    Join Date
    Nov 2003
    Location
    England
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by daveporter
    Hi there,

    I'm importing data into a mySQL database using PHP and one field is a description field, which contains HTML.

    It all works OK apart from the fact that all the double quotes are coming out wierd. Such as:
    table width=&#34450&#34

    How can I stop this happening. The raw data is generated from a Windows APP.

    TIA - Dave Porter
    html_entities
    Your mind is like a parachute. It works best when open.
    (HH The Dalai Lama)

  3. #3
    SitePoint Zealot daveporter's Avatar
    Join Date
    Mar 2002
    Location
    Perth, Western Australia
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks very much for your help...

    The PHP import program is not mine, but I add this to the INSERT command ( all occurances ) and it didn't make any difference....

    Here's an example of the code and the 'htmlentities' I added.

    TIA - Dave

    PHP Code:
    "INSERT INTO ".TABLE_PRODUCTS_DESCRIPTION."
                                    (products_id,
                                    language_id,
                                    products_name,
                                    products_description,
                                    products_url)
                                    VALUES (
                                        '" 
    $v_products_id "',
                                        " 
    $key ",
                                        '" 
    $name "',
                                        '"
    htmlentities($v_products_description[$key]) . "',
                                        '"
    $v_products_url[$key] . "'
                                        )"



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •