I am trying to update columns in my transaction table with data in sessions. I have the session data stored as follows
$session_mem_id = $_SESSION['mem_id'];
$member_data = member_data($session_mem_id, 'mem_id', 'mem_email', 'mem_password', 'mem_address', 'mem_city', 'mem_postcode', 'mem_county', 'mem_country', 'mem_first_name', 'mem_last_name', 'password_recover', 'allow_email', 'admin', 'mem_tel');
And I use this data to update my table as follows
function createTransaction($member_data){
// Insert into the transactions table
$query1 = mysql_query("INSERT INTO `transactions` (mem_id, OrderDate, ship_phone, ship_address, ship_city, ship_county, ship_postcode, ship_country) VALUES('{$_SESSION['mem_id']}', NOW(), '{$member_data['mem_tel']}', '{$member_data['mem_address']}', '{$member_data['mem_city']}', '{$member_data['mem_county']}', '{$member_data['mem_postcode']}', '{$member_data['mem_country']}')") or die(mysql_error());
}
I don't get an error, however the only columns that update on my table are mem_id, orderdate and OrderId as its auto_increment. No data parses that is stored in my $member_data
If I var_dump($member_data) I get the following
array(14) { ["mem_id"]=> string(2) "11" ["mem_email"]=> string(26) "j.hfbgb92@gmail.com" ["mem_password"]=> string(8) "password" ["mem_address"]=> string(16) "54 bvcbv drive" ["mem_city"]=> string(9) "Mggbone" ["mem_postcode"]=> string(8) "gb14 4gb" ["mem_county"]=> string(4) "Kent" ["mem_country"]=> string(14) "United Kingdom" ["mem_first_name"]=> string(4) "Bob" ["mem_last_name"]=> string(12) "Smith" ["password_recover"]=> string(1) "0" ["allow_email"]=> string(1) "1" ["admin"]=> string(1) "1" ["mem_tel"]=> string(11) "07900186785" }
My member_data function is function member_data($mem_id) { $data = array(); $mem_id = (int)$mem_id;
$func_num_args = func_num_args();
$func_get_args = func_get_args();
if($func_num_args > 1) {
unset ($func_get_args[0]);
$fields = '`' . implode('`, `', $func_get_args) . '`';
$data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM members WHERE mem_id = '$mem_id'"));
return $data;
}
}