I am trying to create a a transaction, and to do this I need to parse in my Session data into my Database. My function looks as follows

function createTransaction(){
        // 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(), {$_SESSION['mem_tel']}, {$_SESSION['mem_address']}, {$_SESSION['mem_city']}, {$_SESSION['mem_county']}, {$_SESSION['mem_postcode']}, {$_SESSION['mem_country']})") or die(mysql_error());
        if($query1) {
            // Get the highest ID in the transactions table. This should be the ID of the row we just inserted.
            $tempInfo = mysql_query("SELECT `order_id` FROM `transactions` ORDER BY `order_id` DESC LIMIT 1");
            $tempInfo = mysql_fetch_assoc($tempInfo);
            $orderId = $tempInfo['order_id'];

            // Insert into the transaction details table.
            $query2 = mysql_query("INSERT INTO `transactionDetails` (Order_ID, Product_ID, Price, Quantity) VALUES({$orderId}, {$item_id}, {$price}, {$each_item})");

            if($query2) {
                // Success.
            } else {
                // Error occurred.
                echo 'Query2 Error: ' . mysql_error();
        } else {
            // Error occurred.
            echo 'Query1 Error: ' . mysql_error();

However I get a Mysql error and it's to do with my Value(). Here is my the code when I create my session for the user

$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');

I know I am not parsing the data in correctly, but can somebody show me how to do it?

I put the '' around each session and I no longer get an error, however only mem_id, order_id and orderdate inserts into the database

and the problem is?? what??

Be a part of the DaniWeb community

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