Reputation: 3
I want to use simple oracle update statement with PHP from variable data on Oracle database, but I am getting the error.
oci_bind_by_name(): ORA-01036: illegal variable name/number
Part of the PHP script.
$connection = oci_connect(getenv('DB_USERNAME'), getenv('DB_PASSWORD'), getenv('DB_HOST'), 'AL32UTF8');
$sql = oci_parse($connection, "SELECT * FROM TG_EVENT WHERE
result = 0
AND regnum IS NOT NULL
AND customer_id ='1872680'
AND status_now IN (568, 569, 570)
AND status_now != status_was");
oci_execute($sql);
$res = oci_fetch_all($sql, $rows, null, 1000, OCI_FETCHSTATEMENT_BY_ROW);
$update = oci_parse($connection, "UPDATE TG_EVENT SET result = '1' WHERE customer_id = :customer_id");
oci_bind_by_name($update, ':cutomer_id', $result['CUSTOMER_ID']);
oci_bind_by_name($update, ':regnum', $result['REGNUM']);
oci_bind_by_name($update, ':status_now', $result['STATUS_NOW']);
oci_execute($update);
Upvotes: 0
Views: 133
Reputation: 1891
There are several errors in your code
1- oci_bind_by_name($update, ':cutomer_id', $result['CUSTOMER_ID']);
should be
oci_bind_by_name($update, ':customer_id', $result['CUSTOMER_ID']);
i.e you wrote :cutomer_id instead of :customer_id
2- :regnum
and :status_now
bind variables are not in your query, so remove them or change your query to add these bind variables
Upvotes: 1