Grokbase Groups MySQL mysql May 2003
FAQ
Hey All,

Sorry for making multiple posts, but I need to get this problem resolved.
I'm trying to be able to insert html code and text into a mysql db for use
on a website. Below is my insert string:

$sql = "INSERT INTO hwu_articles (subject, date, author, author_email,
main_body, forum_url, dealtime_name, dealtime_url, man_name, man_url, type,
cost, cost_url, rating, id, page, page_subject, end) VALUES ('$subject',
'$date', '$author', '$author_email', '$main_body', '$forum_url',
'$dealtime_name', '$dealtime_url', '$man_name', '$man_url', '$type',
'$cost', '$cost_url', '$rating', '$id', '$page', '$page_subject', '$end')";

However, I'm having trouble when inserting a lot of HTML data that includes
single and double quotes and I don't how knwo to make use of the add slashes
function.

How do I add this function to my syntax and is is possible to just add it to
the "main_body" column, since this is the column with all the html coding.
Thanks for your help!
Right now my inserts dont work!

Thanks!
--------------------------------------------
-Alex "Big Al" Behrens
E-mail: bigal@3d-unlimited.com
Urgent E-mail: bigal-cell@3d-unlimited.com (Please be brief!)
Phone: 651-482-8779
Cell: 651-329-4187
Fax: 651-482-1391
ICQ: 3969599
Owner of the 3D-Unlimited Network:
http://www.3d-unlimited.com
Send News:
news@3d-unlimited.com

Search Discussions

  • Paul DuBois at May 22, 2003 at 2:02 am

    At 20:43 -0500 5/21/03, Alex Behrens wrote:
    Hey All,

    Sorry for making multiple posts, but I need to get this problem resolved.
    I'm trying to be able to insert html code and text into a mysql db for use
    on a website. Below is my insert string:

    $sql = "INSERT INTO hwu_articles (subject, date, author, author_email,
    main_body, forum_url, dealtime_name, dealtime_url, man_name, man_url, type,
    cost, cost_url, rating, id, page, page_subject, end) VALUES ('$subject',
    '$date', '$author', '$author_email', '$main_body', '$forum_url',
    '$dealtime_name', '$dealtime_url', '$man_name', '$man_url', '$type',
    '$cost', '$cost_url', '$rating', '$id', '$page', '$page_subject', '$end')";

    However, I'm having trouble when inserting a lot of HTML data that includes
    single and double quotes and I don't how knwo to make use of the add slashes
    function.

    How do I add this function to my syntax and is is possible to just add it to
    the "main_body" column, since this is the column with all the html coding.
    Thanks for your help!
    Right now my inserts dont work!
    The easiest thing might be to insert this statement immediately prior
    to your statement above:

    $main_body = addslashes ($main_body);
    Thanks!
    --------------------------------------------
    -Alex "Big Al" Behrens
    E-mail: bigal@3d-unlimited.com
    Urgent E-mail: bigal-cell@3d-unlimited.com (Please be brief!)
    Phone: 651-482-8779
    Cell: 651-329-4187
    Fax: 651-482-1391
    ICQ: 3969599
    Owner of the 3D-Unlimited Network:
    http://www.3d-unlimited.com
    Send News:
    news@3d-unlimited.com

    --
    Paul DuBois
    http://www.kitebird.com/
    sql, query
  • Don Read at May 22, 2003 at 11:27 am

    On 22-May-2003 Alex Behrens wrote:
    Hey All, <snip>
    However, I'm having trouble when inserting a lot of HTML data that
    includes
    single and double quotes and I don't how knwo to make use of the add
    slashes
    function.

    How do I add this function to my syntax and is is possible to just add it
    to
    the "main_body" column, since this is the column with all the html
    coding.
    Thanks for your help!
    Right now my inserts dont work!
    $main_body=addslashes($main_body);
    $sql="INSERT INTO ..."

    Read the PHP manual entry for 'addslashes'.
    (then click the 'magic_quotes_gpc' link).

    Regards,
    --
    Don Read dread@texas.net
    -- It's always darkest before the dawn. So if you are going to
    steal the neighbor's newspaper, that's the time to do it.
    (53kr33t w0rdz: sql table query)

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmysql @
categoriesmysql
postedMay 22, '03 at 1:48a
activeMay 22, '03 at 11:27a
posts3
users3
websitemysql.com
irc#mysql

People

Translate

site design / logo © 2021 Grokbase