0
votes

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sp.sign_ups' doesn't exist (SQL: insert into sign_ups (first_name, last_name, email, user_name, password, re_password, contact, updated_at, created_at) values (hassan, Mehedi, [email protected], marlin, marlin, marlin, 01670654878, 2016-05-15 06:39:07, 2016-05-15 06:39:07))

I am facing above problem while clicking on submit button for sending sign up form data to database.

Here says 'Base table or view not found: 1146 Table 'sp.sign_ups' doesn't exist'. But in my 'sp' named database doesn't have any kind of table named 'sign_ups'. It named 'sign_up'......

Already I dropped the 'sign_up' table once and recreated it. Also restart the 'Apache' and 'MySQL' server. But nothing happened.

This is the controller SignUpController.php

<?php

namespace App\Http\Controllers;

use Request;

use App\Http\Requests;

use App\sign_up;

class SignUpController extends Controller {

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)
{
    //
}

}

This is Model sign_up.php

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class sign_up extends Model { protected $fillable = ['first_name', 'last_name', 'email', 'user_name', 'password', 're_password', 'contact']; }

Can anybody help ?

2
If you've recreated your sign_ups table, please confirm this table was in schema sp.Blank
Will you please explain it @Reno ......Arafat
Hmm, sp is just the name of your database, you must confirm you've recreate this table in this database, not other. As usual, Table 'sp.sign_ups' doesn't exist this kind of error should be no table in your database or you've created your table in other database.Blank
oh. @Reno then sign_up table is under the sp databse. I am sure about that. But you made a mistake that you told 'sp.sign_ups' but it is ' sp.sign_up '......that my prblem. I didn't make any table named ' sign_ups '.....mt table name is ' sign_up '......i didn't get it from where it came!!!Arafat
i guess you're using laravel as your framework. since I don't know laravel, can you tell me where did you configure the 'sign_up' view? and what is in the create() function?carmel

2 Answers

0
votes

You probably have a typo in your code that creates the "insert into..." query.

double check it.

if you don't have a typo there then post your code here

0
votes

In your sign_up.php Model you just need add $table property,

protected $table = "sign_up";

Update sign_up.php Model code should look like this,

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class sign_up extends Model {

protected $table = 'sign_up';

protected $fillable = ['first_name', 'last_name', 'email', 'user_name', 'password', 're_password', 'contact'];

 }