Bonjour,
je vous explique mon problème:
à l'heure actuelle je me sers de php pour inserer des données dans ma base de donnée or je souhaiterai simplement faire appel à une procédure stocké qui sera appelée avec php
bref mes variables que j'ai avec php sont:
$libellemat (varchar2), $id1 (number), $id2 (number), $id3 (number)
Code d'insertion php
Donc j'ai remplacé ce code par l'appel de la procédure qui contient des erreurs à priori au niveau des ocibindbynames:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 $request="insert into pti.materiel (idmateriel,libellemat,idsalarie,idtypemateriel,idsystemeos) values('','$libellemat',$id1,$id2,$id3)"; $insert=ociparse($db_conn,$request); ociexecute($insert);
et voici le code de la procédure stockée
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 $stmt = OCIParse($db_conn, "BEGIN ajoutmateriel(:$libellemat, :$id1, :$id2, :$id3); END;"); OCIBindByName($stmt, ":$libellemat", &$libellemat, -1); OCIBindByName($stmt, ":$id1", &$id1, -1); OCIBindByName($stmt, ":$id2", &$id2, -1); OCIBindByName($stmt, ":$id3", &$id3, -1); OCIExecute($stmt);
C'est la première fois que je crée une procédure stockée et je crois que je m'emmèle les pinceaux
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 create or replace procedure "AJOUTMATERIEL" (libellemat IN VARCHAR2, id1 IN NUMBER, id2 IN NUMBER, id3 IN NUMBER) is begin insert into pti.materiel (idmateriel,libellemat,idsalarie,idtypemateriel,idsystemeos) values('','libellemat',id1,id2,id3); end;
ci joint les erreurs
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of ocibindbyname(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in c:\program files\easyphp1-8\www\intranet\traitementajoutmateriel1.php on line 52 Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of ocibindbyname(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in c:\program files\easyphp1-8\www\intranet\traitementajoutmateriel1.php on line 53 Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of ocibindbyname(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in c:\program files\easyphp1-8\www\intranet\traitementajoutmateriel1.php on line 54 Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of ocibindbyname(). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in c:\program files\easyphp1-8\www\intranet\traitementajoutmateriel1.php on line 55 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\program files\easyphp1-8\www\intranet\traitementajoutmateriel1.php:52) in c:\program files\easyphp1-8\www\intranet\traitementajoutmateriel1.php on line 2
Pouvez vous m'aider à créer correctement ma procédure et à corriger mon code php
merci
Partager