Hi guys,
I have the following sql statement:
$sql = @mysql_query("SELECT * FROM ipn_trans WHERE shipped='' ORDER BY time DESC;");
I have some key fields that are relevant to what I'm trying to do:
shipped - will either be 'yes' or empty
txn_id - will contain a transaction id from paypal
payment_status - will either be 'Pending', 'Failed', or 'Completed'.
I'm trying to list new transactions that havnt been shipped yet, hence the above statement. (I manually update 'shipped' when I've posted the order off)
However, if a transaction is 'Pending', then it changes to 'Completed', a new record is inserted into the database with the same txn_id - so I end up displaying the same transaction twice (once for 'Pending', and once for 'Completed').
I'm in desparate need of an sql statement where I will only display the record in the database that has its status as 'Completed' ONLY if there is more than one record. I still want to show 'Pending' transactions as they come through.
I hope that made some sense!
Kind regards
Mark