MySQL “字段列表”中的未知列“名称”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7875860/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 21:26:28  来源:igfitidea点击:

Unknown column 'name' in 'field list'

mysql

提问by iamlancer

 function Student_model()
     {

         parent::Model();
     }

 function insert_data($name,$roll,$department,$semester)
         {

         $qry="INSERT INTO data (id,name,roll,department,semeseter) values ('',?,?,?,?)";
         $this->db->query($qry, array($name,$roll,$department,$semester));


         }
}

Unknown column 'name' in 'field list'

“字段列表”中的未知列“名称”

INSERT INTO data (id,name,roll,department,semeseter) values ('1','adsfas','117437','4th','3rd')

INSERT INTO data (id,name,roll,department,semeseter) values ('1','adsfas','117437','4th','3rd')

need some help here.

这里需要一些帮助。

回答by laloutre87

The question is old, but i'll add something since no answers has been marked valid.

这个问题很老,但我会补充一些东西,因为没有答案被标记为有效。

The error message states the field "name", so let's ignore misspelling "semeseter" for now.

错误消息指出字段“name”,所以我们暂时忽略拼写错误的“semeseter”。

If the column "name" exists and you got an error message suggesting it doesn't, there is likely to be a "trigger before insert" set for this table that references "name" instead of " new.name " somewhere in the trigger body.

如果列“name”存在并且您收到一条错误消息表明它不存在,则可能为该表设置了一个“插入前触发”,它在触发器的某处引用了“name”而不是“new.name”身体。

I hope this helps people with similar issues.

我希望这可以帮助有类似问题的人。

回答by Michael Eakins

I suggest checking the list of columns for the column in question. It appears that the column you are trying to find does not exist.

我建议检查相关列的列列表。您尝试查找的列似乎不存在。

You might check "semeseter"to ensure that this is not a typo of the English word semester.

您可以检查"semeseter"以确保这不是英文单词的拼写错误semester

This is likely your issue.

这很可能是你的问题。