My insert statement always fails her is the code:
// If form is submitted, then insert into DB
if (!empty($HTTP_POST_VARS["THERE"]) ) {
$NAME = $HTTP_POST_VARS["NAME"];
$DATE_IN = $HTTP_POST_VARS["DATE_IN"];
$SENTENCE = $HTTP_POST_VARS["SENTENCE"];
//$ID = $HTTP_POST_VARS["ID"];
$DISPLAY = $HTTP_POST_VARS["DISPLAY"];
$DETAILS = $HTTP_POST_VARS["DETAILS"];
$PIC = $HTTP_POST_VARS["PIC"];
/*$approved = $HTTP_POST_VARS["approved"];*/
$gb_query =" insert into RESIDENTS(NAME,DATE_IN,SENTENCE,THERE,DISPLAY,DETAILS,PIC) VALUES
('$NAME', '$DATE_IN', '$SENTENCE', '0','$DISPLAY','$DETAILS','$PIC') ";
mysql_query($gb_query);
$res = mysql_affected_rows();
// See if insert was successful or not
if($res > 0) {
$ret_str="Your guestbook entry was successfully added.";
//echo $gb_query;
} else {
$ret_str = "Your guestbook entry was NOT successfully added.";
echo $gb_query;
}
// Append success/failure message
$gb_str .= "<span class=\"ret\">$ret_str</span><BR>";
}
?>
the table description is:
ID = PRIMARY KEY ==INT(50) AUTO INCREMENT
WHEN I ECHO THE QUERY i GET:
Nothing is inserted in the database:
insert into RESIDENTS(NAME,DATE_IN,SENTENCE,THERE,DISPLAY,DETAILS,PIC) VALUES (‘1’, ‘546’, ‘54’, ‘0’,‘45’,‘5’,‘45’) Your guestbook entry was NOT successfully added.
AND here is the form section of the page:
<form name="gb" action="signrimaguest.php" method="post">
<BR><B><div class="poo" style="text-align: right" dir="rtl">
<!--Name: <input type="Text" name="ID" size="30"><p>-->
Name: <input type="Text" name="NAME" size="30"><p>
Date:<input type="Text" name="DATE_IN" size="30"><p>
Sentence:<input type="Text" name="SENTENCE" size="30"><p>
there:<input type="HIDDEN" name="THERE" default='0'size="30"><p>
DISPLAY:<input type="Text" name="DISPLAY" ><p>
DETAILS:<textarea name="DETAILS" size="800" rows="5" COLS ="40"></textarea><P>
PIC:<input type="Text" name="PIC" ><p>
<input type="submit" name="THERE" value="submit" ">
Any ideas? thanks