Im trying to get transaction details of a paypal account, which I was successful in doing so, but I get this long (what i assume is an array) but I need to insert the details into a mysql database. I've tried several foreach methods but apparently I am doing something wrong.

This is the reponse from paypal after successful request (stored as $httpParsedResponse)

TransactionSearch Completed Successfully: Array ( [L_TIMESTAMP0] => 2012%2d08%2d14T18%3a46%3a00Z [L_TIMESTAMP1] => 2012%2d08%2d14T18%3a45%3a32Z [L_TIMESTAMP2] => 2012%2d08%2d13T01%3a45%3a48Z [L_TIMESTAMP3] => 2012%2d08%2d13T01%3a34%3a12Z [L_TIMEZONE0] => GMT [L_TIMEZONE1] => GMT [L_TIMEZONE2] => GMT [L_TIMEZONE3] => GMT [L_TYPE0] => Payment [L_TYPE1] => Payment [L_TYPE2] => Payment [L_TYPE3] => Transfer [L_EMAIL0] => pmd_1333866_per%40yahoo%2ecom [L_EMAIL1] => pmd_1333866_per%40yahoo%2ecom [L_EMAIL2] => pmd_1333866_per%40yahoo%2ecom [L_NAME0] => Joshua%20O [L_NAME1] => Joshua%20O [L_NAME2] => Joshua%20O [L_NAME3] => PayPal [L_TRANSACTIONID0] => 58289472YK615973G [L_TRANSACTIONID1] => 4U113116FL1819900 [L_TRANSACTIONID2] => 2X978155KR373471P [L_TRANSACTIONID3] => 3TH38971MF599302V [L_STATUS0] => Completed [L_STATUS1] => Completed [L_STATUS2] => Completed [L_STATUS3] => Completed [L_AMT0] => %2d100%2e00 [L_AMT1] => %2d50%2e00 [L_AMT2] => %2d200%2e00 [L_AMT3] => 2000%2e00 [L_CURRENCYCODE0] => USD [L_CURRENCYCODE1] => USD [L_CURRENCYCODE2] => USD [L_CURRENCYCODE3] => USD [L_FEEAMT0] => 0%2e00 [L_FEEAMT1] => 0%2e00 [L_FEEAMT2] => 0%2e00 [L_FEEAMT3] => 0%2e00 [L_NETAMT0] => %2d100%2e00 [L_NETAMT1] => %2d50%2e00 [L_NETAMT2] => %2d200%2e00 [L_NETAMT3] => 2000%2e00 [TIMESTAMP] => 2012%2d08%2d25T17%3a59%3a01Z [CORRELATIONID] => bf5b1a824d937 [ACK] => Success [VERSION] => 51%2e0 [BUILD] => 3435050 )

Obviously enough I guess the array is structured as

and this continues for how ever many sets of transaction details there are for each set, ie timestamp, timezone, type, email, ect... - in this case there are 3 sets of transaction details but whatever solution needs to be able to loop through it wheither there is only 1 transaction pulled or 100 ...

Like I said the only goal here is to take this returned array from paypal and insert into a mysql database.

I hope this makes sense, any help at all would be greatly appreciated! Thanks!

Recommended Answers

All 2 Replies

Member Avatar for LastMitch


but I get this long (what i assume is an array) but I need to insert the details into a mysql database.

1) Do you have a DB? Yes, it's good. No, then you need to create a DB and a Table!

2) It seems to me you got confused about how to insert data into the database.

3) When a customer enter the info on the Checkout sheet and Submit the form, the data will go into that database and it will appear in the table.

4) I think your Checkout sheet is not submiting correctly. It has nothing to do with PayPal. If the customer enter their info plus payment it will appear in the PayPal Merchant account. The info will appear in the database too but not the payment info.

5) I think you need you need to fixed your Checkout sheet.

You can store this full Array in your DB table using serialize/unserialize functions of PHP.

    $array = array(
        'id' => 1,
        'name' => 'Joe',
        'phone' => '24543'

    $serialized_array = serialize($array);

    // Insert $serialize_array into DB

    // When pulling it out from the DB you do:

    $retrieved_array = unserialize($DB_Result->DB_Field_of_Array);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.