Issue
I create universal function for insert in Oracle database but is not working correctly.
function Insert($conn,$sqlText,$arrayInput){
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn,$sqlText);
// echo '<pre>' . print_r($arrayVariables, true) . '</pre>';
foreach($arrayInput as $key=>$var)
{
// echo 'varable='.$key.'<br/>'.'value='.$var.'</br>';
oci_bind_by_name($stid,$key,$var);
}
oci_execute($stid);
oci_commit($conn);
oci_free_statement($stid);
oci_close($conn);
}
Any idea why is not working? I cant find way to see what is sending to oracle by executing oci_execute($stid);. or what is binded
Solution
Basically values of array are always string even if I add it as int. So I add check for is_number which solve issue. Thanks for all which try to help me if somebody know why array did not keep int values will be great to share.
Answered By - user3661564 Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.