SQL语法错误和组合字符串错误

Below is a segment of code (note not complete code) that receives a json object parses some info to an array and the arrays in the json object into a string by changing the array to string via implode and adding it to the pervious string.

There seems to be two problems occurring:

1) it says Array to string conversion in /posi_rest_service.php on line 36

 $brontoJSONObject = $_POST['json'];
 $lineItems = ""; 
                $jsonIterator = new RecursiveIteratorIterator(
                new RecursiveArrayIterator(json_decode($brontoJSONObject, TRUE)),
                RecursiveIteratorIterator::SELF_FIRST);
                foreach ($jsonIterator as $key => $val) {
                    if(is_array($val)) {
                            $lineItems .=  '(*)' . (implode("|", $val)); //this is 36!!!!!!!
                        } else {
                            array_push($dataArray, $val);
                            $aCount++;
                        }
                    }
                $result = $conn->prepare("SELECT COUNT(*) FROM bronto_carts WHERE emailAddress = :emailAddress"); 
                $result->bindParam(':emailAddress', $dataArray[8]);
                $result->execute(); 
                $number_of_rows = $result->fetchColumn(); 
                if($number_of_rows > 0) {
                    $tmps = $conn->prepare("DELETE FROM bronto_carts where emailAddress = :emailAddress");
                    $tmps->bindParam(':emailAddress', $dataArray[8]);
                    $tmps->execute();
                }

EDIT new errors: Notice: Array to string conversion in /posi_rest_service.php on line 36

Strict Standards: Only variables should be passed by reference in /posi_rest_service.php on line 54

Try ignore it by use @. You can also try print_r( $val,true) instead of implode.

$brontoJSONObject = $_POST['json'];
$lineItems = ""; 
            $jsonIterator = new RecursiveIteratorIterator(
            new RecursiveArrayIterator(json_decode($brontoJSONObject, TRUE)),
            RecursiveIteratorIterator::SELF_FIRST);
            foreach ($jsonIterator as $key => $val) {
                if(is_array($val)) {
                        $lineItems .=  '(*)' . (@implode("|", $val)); //this is 36!!!!!!!
                    } else {
                        array_push($dataArray, $val);
                        $aCount++;
                    }
                }
            $result = $conn->prepare("SELECT COUNT(*) FROM bronto_carts WHERE emailAddress = :emailAddress"); 
            $result->bindParam(':emailAddress', $dataArray[8]);
            $result->execute(); 
            $number_of_rows = $result->fetchColumn(); 
            if($number_of_rows > 0) {
                $tmps = $conn->prepare("DELETE FROM bronto_carts where emailAddress = :emailAddress");
                $tmps->bindParam(':emailAddress', $dataArray[8]);
                $tmps->execute();
            }