php - Give an array as a value with OCI8 -
i make pre-version of website php , mysql. now, need change database in oracle. question : have type of query mysql/ php :
$id = array("id" => $_get['id']); $sql = 'select * article id = :id'; $requete = $bdd->prepare($sql); $requete->execute($id); $compteur = $requete->rowcount($sql);
so, started update php code :
$sql = 'select * article id = :id'; $requete = oci_parse($identifiants, $sql); oci_bind_array_by_name($requete, ':id', $id, 1); oci_execute($requete); $compteur = oci_num_rows($requete);
where $identifiants contains login, password database. now, refuses execute query because didn't accept array argument on line oci_bind_array; how can upate php query under oracle ?
thanks in advance
since oci_bind_array_by_name
works arrays (it means in query there variable of type array) different execute(array())
work associative arrays in order set values (in case query has non-array inputs).
in case try oci_bind_by_name
(assuming connection ok):
$id = $_get['id']; $sql = 'select * article id = :id'; $requete = oci_parse($identifiants, $sql); oci_bind_by_name($requete, ':id', $id); oci_execute($requete); $compteur = oci_num_rows($requete); oci_free_statement($requete);
Comments
Post a Comment