title: pg_query(): Query failed: ERROR: operator does not exist: integer ~~ unknown\n
body: <p>I'm new to database administration, but i need to migrate one web server on Debian 4.0 32bit to Debian Wheezy (7.6) 64bit and have some trouble that i can't fix with postgresql and php.</p>
  
  <p>Old postgres is 8.1 new is 9.3. </p>
  
  <p>Here is error from apache log:</p>
  
  <pre><code>PHP Warning:  pg_query(): Query failed: ERROR:  operator does not exist: integer ~~
   unknown\nLINE 1: SELECT * from sel_v_pc() WHERE pc_nomer LIKE '%' AND pccat_n...\n
   ^\nHINT:  No operator matches the given name and argument type(s). 
  You might need to add explicit type casts. in /var/www/itweb/register/pc/pc.php on line 66
  </code></pre>
  
  <p>And here is the source:</p>
  
  <pre><code>        $default_sort = 'pc_nomer';
  $allowed_order = array ('pc_nomer', 'structure_name', 'corpus_name', 'office_name', 'cputype_name', 'monitor_nomer', 'employee_name1', 'employee_name3'); 
  
  if (!isset ($_GET['order']) || !in_array ($_GET['order'], $allowed_order)) {
      $order = $default_sort;
  } else {
      $order = $_GET['order'];
  }
  if (!isset ($_GET['find'])) {
  $query = "SELECT * from sel_v_pc() ORDER BY $order, pc_nomer";}
  // ÒÚÐÑÅÍÅ
  else {
      for($j = 0; $j &lt; sizeof($_GET['finom']); $j++)
          {$finom = $_GET['finom'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['fpccat']); $j++)
          {$fpccat = $_GET['fpccat'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['fstruct']); $j++)
          {$fstruct = $_GET['fstruct'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['fustruct']); $j++)
          {$fustruct = $_GET['fustruct'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['fcorpus']); $j++)
          {$fcorpus = $_GET['fcorpus'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['foffice']); $j++)
          {$foffice = $_GET['foffice'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['fotype']); $j++)
          {$fotype = $_GET['fotype'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['fcpu']); $j++)
          {$fcpu = $_GET['fcpu'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['fcpufrecq']); $j++)
          {$fcpufrecq = $_GET['fcpufrecq'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['fram']); $j++)
          {$fram = $_GET['fram'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['fhdd']); $j++)
          {$fhdd = $_GET['fhdd'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['fcd']); $j++)
          {$fcd = $_GET['fcd'][$j];
          }       
      for($j = 0; $j &lt; sizeof($_GET['fempl']); $j++)
          {$fempl = $_GET['fempl'][$j];
          }
      for($j = 0; $j &lt; sizeof($_GET['orderby']); $j++)
          {$forder = $_GET['orderby'][$j];
          }       
      $query = "SELECT * from sel_v_pc() WHERE pc_nomer LIKE '$finom' AND pccat_name LIKE '$fpccat' AND structure_id LIKE '$fstruct' AND understructure_id LIKE '$fustruct' AND corpus_name LIKE '$fcorpus' AND office_name LIKE '$foffice' AND officetype_sign LIKE '$fotype' AND employee_id LIKE '$fempl' AND cputype_id LIKE '$fcpu' AND cpufrecq_ghz LIKE '$fcpufrecq' AND ram_mb LIKE '$fram' AND hdd_gb LIKE '$fhdd' AND cd_type LIKE '$fcd' ORDER BY $forder, pc_nomer";}
  
      $result = pg_query ( $query );
  
       $total = pg_num_rows ( $result );
  ?&gt;
  </code></pre>