I'm writing an export php script to get info out of the payment table. I'm attempting to extract the billing address used from a successful transaction. I'm able to unserialize some [data] but not others. Can anyone help? Is address data double serialized? PHP: if (array_key_exists('interval', $_GET)) { $myInterval= $_GET['interval']; }else{ $myInterval= 90; } if ($myInterval==""){ $myInterval= 90; } $db = mysql_connect("localhost", "user", "password"); mysql_select_db("database_name",$db); $csv_output ="\"payment_id\",\"member_id\",\"product_id\",\"begin_date\",\"expire_date\",\"paysys_id\",\"receipt_id\",\"amount\",\"completed\",\"remote_addr\",\"time\",\"aff_id\",\"payer_id\",\"coupon_id\",\"tm_added\",\"tm_completed\",\"payment_id_temp\",\"marker\",\"canceled_at\""; $csv_output .= ",\"x_First_Name\",\"x_Last_Name\",\"x_Company\",\"x_Address\",\"x_City\",\"x_State\",\"x_Zip\",\"x_Country\",\"x_Phone\",\"x_Customer_IP\""; $csv_output .= "\r"; $result = mysql_query("select * from amember_payments WHERE time >= (NOW() - INTERVAL $myInterval DAY) ORDER BY payment_id "); while($row = mysql_fetch_array($result)) { $payment_data = unserialize(stripslashes($row[data])); $csv_output .= "\"$row[payment_id]\",\"$row[member_id]\",\"$row[product_id]\",\"$row[begin_date]\",\"$row[expire_date]\",\"$row[paysys_id]\",\"$row[receipt_id]\",\"$row[amount]\",\"$row[completed]\",\"$row[remote_addr]\",\"$row[time]\",\"$row[aff_id]\",\"\",\"$row[coupon_id]\",\"$row[tm_added]\",\"$row[tm_completed]\",\"$row[payment_id_temp]\",\"$row[marker]\",\"$payment_data[CANCELLED_AT]\",\"$payment_data[name_f]\",\"$payment_data[name_l]\",\"$payment_data[Company]\",\"$payment_data[street]\",\"$payment_data[city]\",\"$payment_data[state]\",\"$payment_data[zip]\",\"$payment_data[country]\",\"$payment_data[x_Phone]\",\"$payment_data[x_Customer_IP]\""; $csv_output .= "\r"; } print $csv_output; exit; ?>
this line is not correct: $payment_data = unserialize(stripslashes($row[data])); should be $payment_data = unserialize($row[data]); For example: PHP: <?php$a = array("\\\"'", 1,2);$b = serialize($a);print "b=$b\n";print "unserialize(stripslashes(\$b))=".print_r(@unserialize(stripslashes($b)),true)."\n";print "unserialize(\$b)=".print_r(@unserialize($b),true)."\n";?> will output: Code: b=a:3:{i:0;s:3:"\"'";i:1;i:1;i:2;i:2;} unserialize(stripslashes($b))= unserialize($b)=Array ( [0] => \"' [1] => 1 [2] => 2 )