【发布时间】:2016-09-11 03:34:52
【问题描述】:
SQLSTATE[42S02]:未找到基表或视图:1146 表“sp.sign_ups”不存在(SQL:插入sign_ups(first_name、last_name、email、user_name , password, re_password, contact, updated_at, created_at) 值 (hassan, Mehedi, hassanmehedi@gmail.com, marlin, marlin, marlin, 01670654878, 2016-05-15 06:39: 07, 2016-05-15 06:39:07))
单击提交按钮将注册表单数据发送到数据库时,我遇到了上述问题。
此处显示“未找到基表或视图:1146 表“sp.sign_ups”不存在”。 但是在我的“sp”命名数据库中,没有任何类型的名为“sign_ups”的表。它命名为'sign_up'......
我已经删除了一次“sign_up”表并重新创建了它。 同时重新启动“Apache”和“MySQL”服务器。但是什么也没发生。
这是控制器 SignUpController.php
<?php
命名空间 App\Http\Controllers;
使用请求;
使用 App\Http\Requests;
使用 App\sign_up;
类 SignUpController 扩展控制器 {
public function showSignUp()
{
return view('sign_up');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
sign_up :: create(Request::all());
return 'test';
}
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
//
}
}
这是模型 sign_up.php
<?php
命名空间应用程序;
使用 Illuminate\Database\Eloquent\Model;
类 sign_up 扩展模型 { protected $fillable = ['first_name', 'last_name', 'email', 'user_name', 'password', 're_password', 'contact']; }
有人可以帮忙吗?
【问题讨论】:
-
如果您重新创建了
sign_ups表,请确认此表在架构sp中。 -
请你解释一下@Reno ......
-
嗯,
sp只是您的数据库的名称,您必须确认您已在此数据库中重新创建此表,而不是其他。像往常一样,Table 'sp.sign_ups' doesn't exist这种错误应该是你的数据库中没有表或者你已经在其他数据库中创建了表。 -
哦。 @Reno 然后 sign_up 表在 sp 数据库下。我确信这一点。但是你犯了一个错误,你告诉'sp.sign_ups'但它是'sp.sign_up'......这是我的问题。我没有创建任何名为“sign_ups”的表......mt 表名是“sign_up”......我没有从它来的地方得到它!!!
-
我猜你正在使用 laravel 作为你的框架。因为我不知道 laravel,你能告诉我你在哪里配置了“sign_up”视图吗? create() 函数中有什么?