2014-11-21 187 views
0

我需要添加一个简单的表格数据到数据库与laravel
每次张贴的数据进入数据库,但我得到这个错误
Laravel - SQLSTATE [42S22]:列未找到:1054未知的列在字段列表中

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) 

没有tf.FirstName在数据库中既不查询提交 模态

<?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' 
     ]; 
} 

控制器功能

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')); 
     } 


    } 

我不知道这个领域将来到哪里?
没有在阿贾克斯的HTML表单什么叫

+0

是否有可能导致某种SQL触发器? – 2014-11-21 15:48:30

+0

即时消息不使用任何SQL触发器 – 2014-11-21 15:57:22

+0

你的迁移是什么? – 2014-11-21 17:59:54

回答

0

也许,在某个地方迁移,也定义了FirstName列错误告诉我们Unknown column 'tf.FirstName'。当你控制器没有对这个专栏做任何事情时,我建议找到它并删除。

0

列中不存在FirstName列,但我可以看到您有一列Name也许就是那个。

相关问题