First of all use mysql_error() to get the DB errors like this,
error_reporting(E_ALL);
$hostName = 'localhost';
$username = 'vish';
$password = 'dbserver';
$databaseName = 'guestbook';
$connect = mysql_connect($hostName, $username, $password) or die("Failed to connect to the database Server. Error: ".mysql_error());
mysql_select_db($databaseName, $connect) or die("Failed to connect to the database. Error: ".mysql_error());
then,
inside if () where you working with post data check whether execution is reaching there at all or not,
if(isset($_POST['submit']))
{
echo 'I am inside post if';
then try to echo the content of the insert query just before executing it
$querypost = "INSERT into guest VALUES ('' ,'".$name."','".$email."','".$message."','".$date."','".$time."')";
echo "$querypost";
$res = mysql_query($querypost) or die ("Query failed".mysql_error());
printf ("Inserted records: %d\n", mysql_affected_rows());