For debugging purposes I use the following:
# content should be validated to prevent GIGO
$contentOfPost = isset( $_POST['contentOfPost'] ) ? $_POST['contentOfPost'] : FALSE;
if ( ! $contentOfPost && $submit != $_POST['submit'] )
{
echo '<pre>';
print_r( $_POST );
echo '</pre>';
die;
}
else
{
$link = mysql_connect($host, $username, $password);
if(!$link)
{
echo "link";
die(mysql_error());
}
$db_selected = mysql_select_db($DbName, $link);
if( ! $db_selected )
{
echo "dbselect";
die(mysql_error());
}
$insertionToDatabase=
"
INSERT INTO $tableName
(
PostNumber, Date, Time, Content
)
VALUES
(
NULL, $date, $time, $contentOfPost
)
";
$result = mysql_query($insertionToDatabase);
# check your SQL on error
if ( ! $result )
{
echo $insertionToDatabase;
echo '<br />';
die( 'Invalid query: ' . mysql_error() );
}
echo $result;
mysql_close($link);
}//endelse
?>
Also, check your table Field type, Defaults and Attributes and let the database do all the work