Reputation: 967
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?
Upvotes: 2
Views: 2325
Reputation: 270757
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.
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);
Upvotes: 3