【问题标题】:Database Error Occurred: error number 1054 unknown column in codeigniter发生数据库错误:codeigniter 中的错误号 1054 未知列
【发布时间】:2018-03-16 15:40:19
【问题描述】:

我在更改我的 gmail 密码后收到此错误。它以前工作过。

发生数据库错误

错误号:1054 未知列 'g-recaptcha-response' 在 'field 列表'

插入tblsb_userqueries (project_id, username, phone, message, g-recaptcha-response) 值 ('0', 'demo', '0000', '测试', '03AJzQfVCDRIod2TLu')

文件名:models/Common_model.php 行号:8

这是我的 PHPMailer 代码:

<?php
require 'application/third_party/email/PHPMailerAutoload.php';

$mail = new PHPMailer;

//$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host     = 'smtp.gmail.com';                       // Specify main and backup server
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'demo@gmail.com';                   // SMTP username
$mail->Password = 'Demo123#';               // SMTP password
$mail->SMTPSecure = 'ssl';                            // Enable encryption, 'ssl' also accepted
$mail->Port = 587;                                    //Set the SMTP port number - 587 for authenticated TLS
$mail->setFrom('noreply@gmail.com', 'header name');     //Set who the message is to be sent from
$mail->addAddress('demo1@gmail.com');  // Add a recipient
$mail->WordWrap = 50;                                 // Set word wrap to 50 characters
$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = 'Here is the subject';
$mail->Body    = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML('Hi, This is my test email');

if(!$mail->send()) {
   echo 'Message could not be sent.';
   echo 'Mailer Error: ' . $mail->ErrorInfo;
   exit;
}

echo 'Message has been sent';
?>

【问题讨论】:

  • 你的表tblsb_userqueries是否有g-recaptcha-response这个字段?
  • 你能把代码贴在你用过这个查询的地方吗
  • 是的,该字段在表中。谢谢@KMS。在我的联系表格完全工作的前一天,但今天我更改了我的 gmail 密码,之后我在收件箱中收到了我网站联系表格中的任何电子邮件。
  • @jigar-shah 请检查这里错误:imgur.com/gj9TQQU
  • 能否分享您在 Common_model.php 中的代码(查询)以供插入

标签: php mysql codeigniter


【解决方案1】:

尝试以下更改,需要将表字段名称更改为g_recaptcha_response

INSERT INTO tblsb_userqueries (`project_id`, `username`,  `phone`, `message`, `g_recaptcha_response`) VALUES ('0', 'demo', '0000', 'test', '03AJzQfVCDrIod2TLu')

【讨论】:

    猜你喜欢
    • 2017-01-10
    • 2017-06-06
    • 1970-01-01
    • 1970-01-01
    • 2018-09-18
    • 2015-06-28
    • 2013-11-18
    • 2018-04-15
    • 1970-01-01
    相关资源
    最近更新 更多