doufan9395 2014-11-21 15:47
浏览 356

Laravel - SQLSTATE [42S22]:找不到列:1054字段列表中的未知列

i need to add a simple form data into the database with laravel
each time the form posted the data goes into the database but i got this error

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'tf.FirstName' in 'field list' (SQL: insert into `tbl_fundraising_pages` (`Permalink`, `Name`, `Summary`, `Story`, `Goal_Amount`, `End_Date`, `Designation`, `WebAddress`, `Block_SearchEngine`, `CharityID`, `updated_at`, `created_at`) values (Something-Like-That, Something Like That, Something Like That, <p>Something Like That</p> , 500, 11/04/2014, General Fund, Something-Like-That, NewDesig, 1387, 2014-11-21 15:14:19, 2014-11-21 15:14:19)

there is no tf.FirstName filed in the database neither the query Modal

<?php
class Fundraising extends Eloquent{
    protected $table = 'tbl_fundraising_pages';
    protected $fillable = [
        'fundraiser_id',
        'Permalink',
        'Name',
        'Summary',
        'Story',
        'Goal_Amount',
        'End_Date',
        'Designation',
        'WebAddress',
        'Block_SearchEngine',
        'CharityID'
        ];
}

Controller Function

public function postCreatePage(){
        $charities = Charities::where('Charity_Name','=',''.Input::get('NonprofitName').'')->first();
        $data = array(
          'Permalink' => str_replace(' ', '-', Input::get('FundraiserName')),
          'Name' => Input::get('FundraiserName'),  
          'Summary' => Input::get('Summary'),  
          'Story' => Input::get('YourPassion'), 
          'Goal_Amount' => Input::get('GoalAmount'),
          'Designation' => Input::get('Designation'),
          'WebAddress' => str_replace(' ', '-', Input::get('FundraiserName')),
          'Block_SearchEngine' => Input::get('NewDesig')
        );
        if(Input::get('NonprofitName')){
            $data['CharityID'] = $charities->ID;
        }
        $page = new Fundraising();
        foreach ($data as $key => $insert){
            $page->$key = $insert;
        }
        if($page->save()){
            return Response::json(array('message' => 'Done'));
        }


    }

i have no clue from where this filed is coming ?
nothing in the HTML form nothing in the Ajax call

  • 写回答

2条回答 默认 最新

  • doushang3352 2014-11-21 18:04
    关注

    Probably, somewhere in your migration, there defines the FirstName column as the error tells us about Unknown column 'tf.FirstName'. As you controller not doing anything with this column, I suggest to find it and remove.

    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP