簡體   English   中英

注意:數組到字符串的轉換在basic.php on line 1443 Array

[英]Notice: Array to string conversion in basic.php on line 1443 Array

我試圖通過表單發布查詢並收到通知:數組到字符串的轉換在 basic.php 在第 1443 行數組上。

    function updateUSR($id, $columns, $old)
    {
        global $database;
        
        $query = '';
        $new_data = array();

        foreach($columns as $column)
            if(isset($_POST[$column['name']]) && $old[$column['name']] != $_POST[$column['name']])
            {
                $new_data[$column['name']] = $_POST[$column['name']];
                $query = $query.$column['name'].'=:'.$column['name'].', ';
                print $new_data;
            }
                
        if(strlen($query))
        {
            $query=rtrim($query,", ");
            $new_data['name'] = $id;
            
            $stmt = $database->runQueryPlayer("UPDATE users SET ".$query." WHERE a_index=:name ");
            $stmt->execute($new_data);
            $stmt->execute(); // Line 1443
            
            
        }
    }

您正在嘗試在 $new_data 數組上使用 print function 。 您可以使用 foreach 循環遍歷每個值並打印,也可以使用 print_r function。

print_r($new_data);
//or
foreach($new_data as $key => $value) {
        print($value);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM