Created
February 25, 2013 20:57
-
-
Save carlopires/5033229 to your computer and use it in GitHub Desktop.
Demo of PHP OCI with parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ORACLE_HOST = "127.0.0.1"; | |
$ORACLE_PORT = "1521"; | |
$ORACLE_SID = "mysid"; | |
$ORACLE_USER = "myuser"; | |
$ORACLE_PASSWORD = "mypass"; | |
$ORACLE_DSN = " | |
(DESCRIPTION = | |
(ADDRESS = (PROTOCOL = TCP)(HOST = $ORACLE_HOST)(PORT = $ORACLE_PORT)) | |
(CONNECT_DATA = (SID = $ORACLE_SID)) )"; | |
$conn = oci_connect($ORACLE_USER, $ORACLE_PASSWORD, $ORACLE_DSN, 'utf8'); | |
if ($conn) { | |
$param_id = null; | |
$param_seq = null; | |
$st = oci_parse($conn, "UPDATE TEST SET SEQ=:seq WHERE id=:id"); | |
oci_bind_by_name($st, ':seq', $param_seq); | |
oci_bind_by_name($st, ':id', $param_id); | |
$param_id = 2; $param_seq = 2; | |
oci_execute($st); | |
$param_id = 7; $param_seq = 3; | |
oci_execute($st); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment