im trying to use mysql_num_rows in laravel but laravel says it not the same way like in 'raw php'
example:
$users = DB::table('users')
         ->where('username', '=', $username)
         ->where('password', '=', $password)
         ->get();
what i want to do:
$count = mysql_num_rows($users);
   if($count > 0 ){
      $user->login = $request->login;
      $user->email = $request->email;
      $user->password = $request->password;
      Auth::login($user);
      return redirect("/");
      }else{
         return "datos incorrectos";
      }
what laravel says:
Call to undefined function App\Http\Controllers\Auth\mysql_num_rows()
PD: its not philosophy of code just make commets about that question, i dont want answers like "u gonna crypt that thing?", "why not use [insert my faborite ORM]" is just a simple question THANKS
mysql_num_rows — Get number of rows in result.
The mysqli_num_rows() function returns the number of rows in a result set.
We can get the total number of rows in a table by using the MySQL mysqli_num_rows() function. Syntax: mysqli_num_rows( result ); The result is to specify the result set identifier returned by mysqli_query() function.
Currently Laravel supports four database systems: MySQL, Postgres, SQLite, and SQL Server.
Instead of using mysql_* functions, you should use count() instead. It can be chained to Eloquent, query builder, or collections.
$users_count = DB::table('users')
     ->where('username', '=', $username)
     ->where('password', '=', $password)
     ->count();
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With