2014-11-21 185 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也許就是那個。

相關問題