S
S
sflyer2017-03-06 12:40:35
PHP
sflyer, 2017-03-06 12:40:35

Oracle 10G + php7 How to enter data from a field in sql query?

Mistake:

Warning: oci_bind_by_name(): ORA-01036: неверное имя/номер переменной

The code:
$fir = $_POST['date1'];
$end = $_POST['date2'];
$row = oci_parse($conn, "Select distinct MG.*, OTD.* from MG, OTD, HK where HK.DG>=':DST' and HK.DG<=':DED'");
 oci_bind_by_name($row, ':DST', $fir);
 oci_bind_by_name($row, ':DED', $end);

<p>Ваше время <input type="text" name="date1" value="01.02.2017"/>
 <p>Ваше время <input type="text" name="date2" value="01.03.2017"/><input type="submit" />

How to transfer the data from the field to sql so that oracle understands them?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yevgeniy Kisselyov, 2017-03-06
@sflyer

Try

$row = oci_parse($conn, "Select distinct MG.*, OTD.* from MG, OTD, HK where HK.DG>=:DST and HK.DG<=:DED");

S
sflyer, 2017-03-06
@sflyer

The error disappeared, but now a strange situation - there are no errors, but nothing happens. I will continue the code. I can't figure out what's wrong? There is no conclusion. The query works in the DBMS, similar code is executed in another file. There are still suspicions that something is wrong with the fields anyway.

oci_execute($row, OCI_DEFAULT);
       while ($get_result = oci_fetch_assoc($row)){
  $result[NPP] = $get_result;
  return $result;
     }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question