PHP:数组错误


PHP: Errors in array?

这是我的functions.php文件,当我运行它时,我得到了一个错误。文件的源代码为:

<?php
function data_insert($to, $from, $text, $ip1, $ip2, $ip3, $ua) {
  try {
    $db = pdoConnect();
    $query = 
      "INSERT INTO sms (
        recepient,
        sender,
        message,
        ip1,
        ip2,
        ip3,
        ua,
        result
      )
      VALUES (
        :recepient,
        :sender,
        :message,
        :ip1,
        :ip2,
        :ip3,
        :ua,
        :result
      )";
    $sqlVars = array(
      ':recepient' => $to;
      ':sender' => $from;
      ':message' => $text;
      ':ip1' => $ip1;
      ':ip2' => $ip2;
      ':ip3' => $ip3;
      ':ua' => $ua;
      ':result' => $result;
    );
    $stmt = $db->prepare($query); 
    if (!$stmt->execute($sqlVars)){
      // Error: column does not exist
      return false;
    }
    $inserted_id = $db->lastInsertId();
    $stmt = null;
    return $inserted_id;
  } catch (PDOException $e) {
    addAlert("danger", "Oops, looks like our database encountered an error.");
    error_log("Error in " . $e->getFile() . " on line " . $e->getLine() . ": " . $e->getMessage());
    return false;
  } catch (ErrorException $e) {
    addAlert("danger", "Oops, looks like our server might have goofed. If you're an admin, please check the PHP error logs.");
    return false;
  } 
}
?>

错误是:

解析错误:语法错误,意想不到的';',期待')'在/home/appfest/public_html/functions.php第30行

第30行包含:

$sqlVars = array(
谁能帮我解决这个问题?任何帮助将不胜感激!

数组值必须以逗号分隔:

$sqlVars = array(
  ':recepient' => $to,
   ':sender' => $from,
   ':message' => $text,
   ':ip1' => $ip1,
   ':ip2' => $ip2,
   ':ip3' => $ip3,
   ':ua' => $ua,
   ':result' => $result
 );