После перенаправления после входа в систему отображается следующая ошибка. В показывает неизвестный столбец как «id». После входа в систему контроллер перешел в функцию оплаты. В этой функции я использовал БД для процесса оплаты. Может ли кто-нибудь помочь исправить ошибку?SQLSTATE [42S22]: Столбец не найден: 1054 Неизвестный столбец 'id' в 'списке полей' в laravel 4
Здесь usp_payment_detail является моей базой данных.
Ошибка:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'id' in 'field list' (SQL: call usp_payment_details(null,null))
Процедура:
BEGIN
-- Ashok Kumar, 25/11/2015
-- V1.3
-- Parameters are optional.
-- Parameter values for "is_completed" are :
-- 0 - incomplete , 1 - complete , null - for complete/incomplete
-- Usage
-- call usp_payment_details(null,'babyname');
-- call usp_payment_details(null,null);
DECLARE input_is_completed tinyint(4) default null;
DECLARE input_service_name varchar(200) default null;
DECLARE dynamic_where varchar(3000);
set input_is_completed=(select is_completed);
set input_service_name=(select service_name);
set dynamic_where='';
if input_is_completed is null then
set dynamic_where=concat(' where paid_at is not null');
else if input_is_completed=0 then
set dynamic_where=concat(' where is_completed is null and paid_at is not null');
else if input_is_completed=1 then
set dynamic_where=concat(' where is_completed is not null and paid_at is not null');
end if;
end if;
end if;
DROP TEMPORARY TABLE IF EXISTS tmpprocess_tables;
CREATE TEMPORARY TABLE tmpprocess_tables
(row_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,tablename varchar(100));
set @db_name=(SELECT DATABASE());
if input_service_name is null then
begin
insert into tmpprocess_tables(tablename)
SELECT table_name FROM information_schema.tables
WHERE [email protected]_name and table_name not in('logs','users');
end;
else
begin
set @insert_sql=concat('insert into tmpprocess_tables(tablename)
SELECT table_name FROM information_schema.tables
WHERE table_schema=','',@db_name,'',' and table_name like concat('%',',input_service_name,','%')');
Prepare stmt from @insert_sql;
Execute stmt;
end;
end if;
DROP TEMPORARY TABLE IF EXISTS tmppopulate_payments;
CREATE TEMPORARY TABLE tmppopulate_payments
(sno INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,primary_id int(11),tab_name varchar(200)
,is_plan varchar(100),is_name varchar(100),amount decimal(10,2),is_completed datetime,paid_at datetime,first_name varchar(50),
middle_name varchar(50),last_name varchar(50),initial varchar(50),full_name varchar(50));
set @count=(select count(row_id) from tmpprocess_tables);
set @ctr=1;
WHILE(@ctr<[email protected]) DO
set @tableName=(select tableName from tmpprocess_tables where [email protected]);
SET @insert_sql=concat('insert into tmppopulate_payments(primary_id,tab_name,is_plan,is_name,amount,is_completed,paid_at,first_name,middle_name,last_name,initial,full_name)
select id,','', @tableName,'',' ,is_plan,is_name,amount,is_completed,paid_at,first_name,middle_name,last_name,initial,full_name from ', @tableName,' ',dynamic_where);
PREPARE stmt1 FROM @insert_sql;
EXECUTE stmt1;
SET @[email protected]+1;
END WHILE;
set @select_sql=concat('select sno,primary_id,tab_name,is_plan,is_name,amount,is_completed,paid_at,first_name,middle_name,last_name,initial,full_name from tmppopulate_payments order by paid_at desc');
PREPARE stmt1 FROM @select_sql;
EXECUTE stmt1;
End
LoginController:
public function payment($t)
{
$showFilter = 0;
$table = [];
$status = "null";
$service_name= "null";
// $serviceArr= $tab_name;
if(Input::has('status'))
{
$status = "'" .Input::get('status') . "'";
}
if(Input::has('service_name'))
{
$service_name = "'" . Input::get('service_name') . "'";
}
$table =array(''=>'- Select -');
$data = DB::select("select TABLE_NAME from information_schema.tables where TABLE_SCHEMA = 'urbanedg_mn'");
foreach ($data as $key => $value)
{
$table[$value->TABLE_NAME] = $value->TABLE_NAME;
}
$data = DB::select("call usp_payment_details($status,$service_name)");
return View::make('backoffice/loginpage/payment')->with('table',$table)
->with('data',$data)
->with('statusArr',CustomClass::$StatusArr)
->with('serviceArr',CustomClass::$ServiceArr)
->with('s',Input::has("s")?Input::get("s") : 0)
->with('msg',Input::has("msg")?Input::get("msg") : '')
->with('t',$t);
}
Как я могу видеть временную таблицу? – kailashkumar
временная таблица - это всего лишь имена таблиц, возвращаемые sql, « SELECT имя_таблицы FROM information_schema.tables WHERE table_schema = @ db_name и table_name не в (« logs »,« users »);». –
где я добавляю столбец 'id'? – kailashkumar