插入查询无效

时间:2016-09-27 05:56:50

标签: php postgresql insert

我已经在脚本中进行了插入查询,但是当它启动时却出现了像这样的错误

  

警告:pg_query():查询失败:错误:语法错误在或附近":"第2行:注意:未定义的变量:第60行的D:\ xampp \ htdocs \ Feedback ... ^中的行:D:\ xampp \ htdocs \ FeedbackALC \ user \ send_mail.php

我的剧本:

 <?php
session_start();
 require 'phpmailer/PHPMailerAutoload.php';

         $email = $_POST['email'];                    
         $password = $_POST['password'];
         $to_id = $_POST['toid'];
 $to_id2 = $_POST['toid2'];
         $message = $_POST['message'];
         $subject = $_POST['subject'];

         $mail = new PHPMailer;
         $mail->isSMTP();
         $mail->Host = 'smtp.gmail.com';
         $mail->Port = 587;
         $mail->SMTPSecure = 'tls';
         $mail->SMTPAuth = true;
         $mail->Username = $email;
         $mail->Password = $password;
         $mail->setFrom('learningCenter@anabatic.com', 'Anabatic Learning Center');
         $mail->addReplyTo('learningCenter@anabatic.com', 'Anabatic Learning Center');
         $mail->addAddress($to_id);
         $mail->Subject = $subject;
         $mail->msgHTML($message);

 $mail2 = new PHPMailer;
         $mail2->isSMTP();
         $mail2->Host = 'smtp.gmail.com';
         $mail2->Port = 587;
         $mail2->SMTPSecure = 'tls';
         $mail2->SMTPAuth = true;
         $mail2->Username = $email;
         $mail2->Password = $password;
         $mail2->setFrom('learningCenter@anabatic.com', 'Anabatic Learning Center');
         $mail2->addReplyTo('learningCenter@anabatic.com', 'Anabatic Learning Center');
         $mail2->addAddress($to_id2);
         $mail2->Subject = $subject;
         $mail2->msgHTML($message);


          if($mail->send()&&$mail2->send()){
            echo "Mail berhasil terkirim";
       }  else {
            echo "mail failed send";
            $error = "Mailer Error: " . $mail->ErrorInfo;
            ?>
            <script>alert('<?php echo $error ?>');</script>
            <?php
       }

   include "../connect.php";

   $training_dtl_id = "(select max(training_dtl_id)+1 from training_dtl)";
   $training_mst_id = strip_tags($_POST['id']);
   $user_id = $_SESSION['user_id'];
   $create_by = $_SESSION['user_name'];
   $change_by = $_SESSION['user_name'];

   $query = "INSERT into training_dtl values (".$training_dtl_id.",".$training_mst_id.",".$user_id.",now(),".$create_by.",now(),".$change_by.",FALSE)";
   $result = pg_query($conn, $query);
?>

0 个答案:

没有答案