Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/257.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 正在将会话数据解析为my INSERT函数_Php_Mysql - Fatal编程技术网

Php 正在将会话数据解析为my INSERT函数

Php 正在将会话数据解析为my INSERT函数,php,mysql,Php,Mysql,我正在尝试将我的成员数据会话解析到我的函数中,但是我不确定如何执行此操作。我的职能是 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

我正在尝试将我的成员数据会话解析到我的函数中,但是我不确定如何执行此操作。我的职能是

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()");
    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();
    }
}
在值所在的位置(第3行),我想插入会话中的数据

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

我该怎么做?

({$\u SESSION['mem\u id']},{$\u SESSION['mem\u email']},{$\u SESSION['mem\u password']},…)
给我一个mysql错误忘记了值周围的
,例如,
{$\u SESSION mem id']}
。你知道SQL,对吧?你到底想插入什么?您的表似乎有一个名为
mem\u id
的列,但代码的最后一行显示了完全不同的内容。@JaredFarrish它现在可以工作了,但数据只添加到mem\u id、order\u id和orderdate中,其他所有内容都为空