Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You provide 2 params for <code>$this-&gt;bedrijven_model-&gt;get_search($match, $match2);</code>, but then only provide one in the function itself : <code>get_search($match)</code>. So:</p> <pre><code>function get_search($match, $match2 = false) { $this-&gt;db-&gt;like('Bedrijfsnaam', $match); $this-&gt;db-&gt;or_like('Postcode', $match); //etc if($match2){ $this-&gt;db-&gt;where('Postcode', $match2); } } </code></pre> <p>...should work?</p> <p><strong>UPDATED</strong></p> <p>In chat it became obvious that it was better not to use active record, since it was a bit of a complex query. Instead, I offered this raw SQL:</p> <pre><code>$query = "SELECT * FROM (`bedrijfcategorieen`) JOIN `bedrijven` ON `bedrijfcategorieen`.`idbedrijven` = `bedrijven`.`idbedrijven` JOIN `categorieen` ON `bedrijfcategorieen`.`idcategorieen` = `categorieen`.`idcategorieen` WHERE (`Bedrijfsnaam` LIKE '%".$this-&gt;input-&gt;post('search')."%' OR `Plaats` LIKE '%".$this-&gt;input-&gt;post('search')."%' OR `Telefoonnummer` LIKE '%".$this-&gt;input-&gt;post('search')."%' OR `Email` LIKE '%".$this-&gt;input-&gt;post('search')."%' OR `Website` LIKE '%".$this-&gt;input-&gt;post('search')."%' OR `Profiel` LIKE '%".$this-&gt;input-&gt;post('search')."%' OR `Adres` LIKE '%".$this-&gt;input-&gt;post('search')."%' OR `Categorie` LIKE '%".$this-&gt;input-&gt;post('search')."%') AND (`Postcode` = `".$this-&gt;input-&gt;post('cookie')."`) GROUP BY `bedrijfcategorieen`.`idbedrijven`"; </code></pre> <p>... with this bit to retrieve the result set:</p> <pre><code>$result = $this-&gt;db-&gt;query($query); </code></pre> <p><code>$this-&gt;input-&gt;post('search')</code>and <code>$this-&gt;input-&gt;post('cookie')</code> can be replaced with <code>$match</code>and <code>$match2</code> in the above sql. I also suggested setting a default for the cookie, since it can be erased from the input field by the user; something like </p> <pre><code>$match2 = $this-&gt;input-&gt;post('cookie') ? $this-&gt;input-&gt;post('cookie') : 'default'; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload