I've been trying to solve this problem that has faced me many times on my website..
I have written a forum program. It works perfectly. However, sometimes a user tells me that he tried to post his comment, but his comment didn't appear on the page, and that he didn't see the message that tells him that his comment was successfully sent! This problem happened to me too. I tried to reload the page in order to re-post the data, but it was all in vain!
I tried to edit my code and inserted after mysql_query("..") or die(mysql_error());
It was all in vain-- no MySQL error message appeared!
I'm sure the problem is not because of an error in values or MySQL syntax, or that the input may contain special characters because it doesn't.
The code is:
<?php session_start(); $Username = $_SESSION['username']; $commentTxt = mysql_real_escape_string($_POST['commentTxt']); require_once('connect.php'); mysql_query("insert into ctable(Sender,Comment) values('$Username','$commentTxt')") or die(mysql_error()); echo 'Your comment was successfully sent.'; ?>
Any help would be really appreciated.