S
S
sflyer2017-11-30 07:37:26
PHP
sflyer, 2017-11-30 07:37:26

Oci_execute, like and variables in the request, where is the error?

There is this form:

<input type="text" name="searchdata" size="40" autocomplete="off" placeholder="ospk_id" />
<select required name="EN">	
  <option value="DATA">Дата</option>	
  <option value="RANDOM">Случайное значение</option>	
  <option value="SERIA">Серия</option>
  </select>
<input type="submit" value="ПОИСК"/> <br>


And this code in php. The point is that the values ​​of the text field and the selector are passed through post (the values ​​come, checked through echo). I need to do like, where the value from the selector is the table field, from the text field is the value from the search.
If you write the name of the table field manually - it works fine. If you make the table field value a variable, as in the code below, the search does not work. It doesn't throw any errors, but the array is empty. Can you please tell me how to make this work? Thanks :)
$selector=$_POST['EN'];
$gets='%'.$_POST['searchdata'].'%';
  $row2 = oci_parse($conn, "select * from FOR_SEARCH where :sel LIKE :search");
  oci_bind_by_name($row2,':search', $gets);
oci_bind_by_name($row2,':sel', $selector);
  oci_execute($row2, OCI_DEFAULT);
    while ($get_result2 = oci_fetch_assoc($row2)){
      $result2=$get_result2;
*тут вывод данных из массива в таблицу*}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question