I finally found the cause of why my PayPal IPN PHP script stopped working. However, I have yet to find the solution. I have found out that the script cannot handle a database table with more than approximately 1000 entries(lines), in this case the script is not completed correctly. Seeing as my database table now has more than 1000 entries and that cannot really be changed, I need somehow to make the script work regardless. The part of the PHP script where the database is handles has been inserted below. Anyone who can find a solution? function handleCompleted() { global $LOGFILE, $PRICE, $CURRENCY, $ADMIN_MAIL, $PAYPAL_MAIL, $req, $txn_id, $payer_email, $password, $first_name, $last_name, $address_street, $address_city, $address_state, $address_country, $payment_amount, $payment_currency, $receiver_email; mysql_connect("dbnameaddress", "dbname", "password") or logToFile($LOGFILE, "SQL error connecting"); //die(mysql_error()); mysql_select_db("dbname") or logToFile($LOGFILE, "SQL error selecting"); //die(mysql_error()); // check that txn_id has not been previously processed $result = mysql_query("SELECT * FROM feast WHERE transaction_id = '".$txn_id."'") or logToFile($LOGFILE, "SQL error querying"); //die(mysql_error()); $fail = false; $error = ""; if (mysql_num_rows($result) > 0) { $error .= "IPN - duplicate transaction"; $fail = true; } // check that receiver_email is your Primary PayPal email if (strcmp($receiver_email, $PAYPAL_MAIL) != 0) { $error .= "IPN - wrong receiver mail:" . $receiver_email. " "; $fail = true; } // check that payment_amount is correct if ( abs($payment_amount - $PRICE) > 0.0001 ) { $error .= "IPN - amount wrong: ". $payment_amount; $fail = true; } // check that payment_currency is correct if (strcmp($payment_currency, $CURRENCY) != 0) { $error .= "IPN - currency wrong"; $fail = true; } if ($fail) { logToFile($LOGFILE, $error); mail($ADMIN_MAIL, $error, $req); mysql_close(); return; } //payment ok, create entry in database $password = getRandomString(); mysql_query("INSERT INTO feast (transaction_id, email, password, firstname, lastname, street, city, state, country, login) VALUES('".$txn_id."','".$payer_email."','".$password."','".$first_name."','".$last_name."','" .$address_street."','".$address_city."','".$address_state."','".$address_country."','0')") or die(mysql_error()); mysql_close(); sendNewUserMail($password); } PHP:
Fix found! It was due to an error in the database's primary key. Took my ages to find the solution, but it suddenly appeared before my eyes!
I was going to suggest you look at indexes as well. I'm guessing the primary key was int(3)? I usually make them int(11)
I would of suggested it would of been a 'MySQL' problem myself as well, seeing as the code looks right.