title: Laravel: Check if MySQL query has result
body: <p>First Laravel project. I have a controllerfunction what checks if there any record with that barcode. If no insert a record. If yes add one for the count.</p>
  
  <pre><code>public function sellmode(Request $request){
      $barcode=$request-&gt;barcode;
      $test = DB::select('select count from sellmode where barcode = ?', [$barcode]);
      $row_cnt = mysqli_num_rows($test);
      if ($row_cnt == 0) {
          Debugbar::info('Új sor');
          DB::insert('insert into sellmode (barcode, count) VALUES (?, ?)', [$barcode, '1']); 
      } else {
          Debugbar::info('Meglévő frissítése');
          DB::update('update sellmode set count = count + 1 WHERE barcode = ?' [$barcode]);
      }
      return view(sell);
  </code></pre>
  
  <p>}</p>
  
  <p>When I tried it, it had the following error:</p>
  
  <blockquote>
    <p>ErrorException in SellController.php line 17: mysqli_num_rows()
    expects parameter 1 to be mysqli_result, array given</p>
  </blockquote>
  
  <p>What did I wrong?</p>