problems with inserting data in database

Posted by jannes braet on Stack Overflow See other posts from Stack Overflow or by jannes braet
Published on 2012-06-10T16:30:50Z Indexed on 2012/06/10 16:40 UTC
Read the original article Hit count: 162

Filed under:
|
|
|
$message=$_POST['answer'];
$message=nl2br($message);
$message=strip_tags($message, '<p><a><b><i><strong><em><code><sub><sup><img><ul><ol><li>');
$message = mysql_real_escape_string($message);
$user=$_SESSION['SESS_MEMBER_ID'];
$qry="INSERT INTO forum_rules (message,author,date) VALUES ($message,$user,'".date("Y-m-d H:i:s")."')";
$result=mysql_query($qry) or die(mysql_error());
if (!$result) {
echo "error inserting data into database";
} else { 
    ...
    }

this codes always outputs error inserting data into database and i don't see what i'm doing wrong. i hav also tried to do it without the date part but that didn't work tho. can someone please tell me what i'm doing wrong here

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql