Home > database >  Laravel does not return query results
Laravel does not return query results

Time:12-11

i am trying to query a database table in laravel 8

$password_resets = DB::table('password_resets')->where('email', $value)->first();

the table name is correct, the record with the concerned value does exist but the query is returning null results.

DB::table('password_resets')->where('email', $value)->toSql();

returns

select * from `password_resets` where `email` = ?  

CodePudding user response:

try to insert a static valid email that exists and then see the result, if it does then there will have a problem in $value

$password_resets = DB::table('password_resets')->where('email', '[email protected]')->first();
dd($password_resets);

don't forget to write

use DB;

CodePudding user response:

first in form html tag name email. $value = $request['email']; use DB; if you not use at top $password_resets = DB::table('password_resets')->where('email', $value)->first(); Now i think working fine

  • Related