Вопрос

The following binding is not working? it prevents event the previous outputs.

oci_bind_by_name($stid, ':CONTRACT', 'BC');
oci_bind_by_name($stid, ':TAX_REGIME_DB', 'VAT');

The following one is working

  $contract = 'BC';
  $vat = 'VAT';

oci_bind_by_name($stid, ':CONTRACT', $contract);
oci_bind_by_name($stid, ':TAX_REGIME_DB', $vat);

please can anybody tell me what the difference is?

Это было полезно?

Решение

oci_bind_by_name() expects a variable reference as its third argument, so your static string value is not a valid argument. You must bind a variable as a third argument. That's why your second example does work.

You'll need to place your strings into variables and bind those just as you did in the second case.

The function prototype:

bool oci_bind_by_name ( resource $statement , string $bv_name , mixed &$variable [, int $maxlength = -1 [, int $type = SQLT_CHR ]] )

I would recommend turning up error reporting and enabling display_errors. You should probably be seeing warnings about the argument expecting a reference. Always do this in development:

; In php.ini
error_reporting = E_ALL
display_errors = On

// Or at runtime
error_reporting(E_ALL);
ini_set('display_errors', 1);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top