HTML data to MySql

Discussion in 'PHP' started by canishk, Mar 19, 2009.

  1. #1
    Hi,

    I have some article which posted through FCK Editor, When I tried to insert that into a table it shows some error like this:
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'id,user,head,article,dop values('NewWorld',1237339114,'new world','new world new' at line 1
    Code (markup):
    content :
    
    $content	= addslashes(addslashes(trim($_POST['editor'])));
    
    PHP:
    query:
    $data_query	= "insert into article id,user,head,article,dop values('$id',$userid,'$header','$content','$dopost')";
    PHP:
    Please suggest me how can I solve this

    Thanks in advance
     
    canishk, Mar 19, 2009 IP
  2. basecore

    basecore Peon

    Messages:
    47
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    should be

    $data_query = "insert into article (id,user,head,article,dop) values('$id','$userid','$header','$content','$dopost')";
     
    basecore, Mar 19, 2009 IP
  3. canishk

    canishk Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Oh thank you, I was thinking, it was because of the html tags.

    thanks for the help basecore.
     
    canishk, Mar 19, 2009 IP