$connection = mysql_connect($host,$usernamee,$passwordd) or die ('Could not connect to server.');
$db = mysql_select_db($database,$connection) or die ('Could not select database.');
$sqlerror = mysql_error();
//The next line is where the error is, please help me out....
$sqlinsert = "INSERT INTO usercomments(namee, emailaddress, comments, datesent) VALUES ('".$fName."', '".$emaill."', '".$commentt."', '"$datee."')";
$sqlinsertt = mysql_query($sqlinsert) or die ('Could not insert record');
if($sqlinsertt)
{
echo '<br><br>RECORD INSERTED SUCCESSFULLY <br>';
}
else
{
echo '<br>Record cannot be inserted with Shipper Login:<br> ';
//echo 'error$sqlerror';
}
?>
First of all welcome to daniweb.
And did you not read my signature saying not to bump old topics. Also please use code tags as they can make it easier to read your post. As for your question, the following code should do the trick:
$connection = mysql_connect($host,$usernamee,$passwordd) or die ('Could not connect to server.');
$db = mysql_select_db($database,$connection) or die ('Could not select database.');
$sqlerror = mysql_error();
$fName=mysql_real_escape_string($fName);
$emaill=mysql_real_escape_string($emaill);
$commentt=mysql_real_escape_string($commentt);
$datee=mysql_real_escape_string($datee);
$sqlinsert = "INSERT INTO usercomments(namee, emailaddress, comments, datesent) VALUES ('$fName', '$emaill', '$commentt', '$datee')";
$sqlinsertt = mysql_query($sqlinsert) or die ('Could not insert record');
if($sqlinsertt)
{
echo '<br><br>RECORD INSERTED SUCCESSFULLY <br>';
}
else
{
echo '<br>Record cannot be inserted with Shipper Login:<br> ';
//echo 'error$sqlerror';
}
?>
Reputation Points: 410
Solved Threads: 258
Occupation: Genius
Offline 3,004 posts
since Sep 2007