Please help as i have an issue. I have a callback script, that another website is sending me some data, and mysql is not updating the records. I didn't mind securing my code yet, because it's not that important at this testing stage. My code is:
$dbhost = 'localhost';
$dbuser = 'user';
$dbpass = 'pass';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'dbname';
mysql_select_db($dbname);
$postData = $_POST; //GET ALL POST DATA
//GET ALL DATA FROM POST AND PREPARE IT FOR SQL
$mId = $postData['id'];
$mDone = date('Y-m-d H:i:s',$postData['donedate']);
$mStatus = $postData['status'];
$mText = $postData['txtstatus'];
if ($mText == 'DELIVRD')
$mText = 'DELIVERED'; //Correction of test status
$mPhone = $postData['receiver'];
//ADD TO DB
if ($postData['type'] == 1){ //success
$sql = mysql_query("UPDATE message_details SET doneDate='$mDone', status='$mText' WHERE contact='$mPhone' AND msgId='$mId'");
echo "UPDATE message_details SET doneDate='$mDone', status='$mText' WHERE contact='$mPhone' AND msgId='$mId'"
}elseif ($postData['type'] == 2) {//FAILED
$sql = mysql_query("UPDATE message_details SET doneDate='$mDone', status='FAILED' WHERE contact='$mPhone' AND msgId='$mId'");
echo "UPDATE message_details SET doneDate='$mDone', status='FAILED' WHERE contact='$mPhone' AND msgId='$mId'"
}
Echoing the mysql query and then running it manual in my DB, works fine. I get around 10 requests per second. Why doesn't it work when this code is running
Thanks
EDIT: i added this line in the code: file_put_contents('errors.txt', mysql_error($conn).'\n',FILE_APPEND); and the return is:
\n\n\n\n\n\n\n\n\n\n\n
So no errors from the mysql