title: PHP to Codeigniter syntax - Subtraction selecting from db / form input
body: <p>I am trying to turn a php mysql statement into Codeigniter syntax. The code selects all from a db but the zone difference equals to two form inputs subtracted from each other. Any help is much appreciated.</p>
  
  <p>PHP Version</p>
  
  <pre><code>select * from zone_cost where zone_diff =
  @(
  (select zone from station_zone where station ='FORMINPUT') - (select zone from station_zone where station ='FORMINPUT')
  );
  </code></pre>
  
  <p>Codeigniter Attempted Version</p>
  
  <pre><code>$zd = (
  $this-&gt;db-&gt;select('zone');
  $this-&gt;db-&gt;get_where('station_zone','station' =&gt; $this-&gt;form-&gt;input('station'));
  ) - ($this-&gt;db-&gt;select('zone');
  $this-&gt;db-&gt;get_where('station_zone','station' =&gt; $this-&gt;form-&gt;input('station2'));
  );
  
  $this-&gt;db-&gt;select('zone_cost');
  $this-&gt;db-&gt;where('zone_diff', $zd);
  </code></pre>